Skip to content

Commit

Permalink
Merge pull request #35 from wenhu1024/fix/address_kernel
Browse files Browse the repository at this point in the history
[fix] modify kernel address
  • Loading branch information
reoLantern authored Dec 7, 2024
2 parents d9ddc09 + 5bef7fb commit 3db97c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
15 changes: 11 additions & 4 deletions gpgpu-testcase/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ cmake_minimum_required(VERSION 3.21)
set(PROJECT spike_driver)
project(${PROJECT})

set(CMAKE_CXX_STANDARD 17)
# Define KERNEL_ADDRESS if not already defined (default: 0x800000b8)
if(NOT DEFINED KERNEL_ADDRESS)
message(STATUS "KERNEL_ADDRESS not specified, using default address 0x800000b8")
set(KERNEL_ADDRESS "0x800000b8")
else()
message(STATUS "Using specified KERNEL_ADDRESS: ${KERNEL_ADDRESS}")
endif()

add_compile_definitions(KERNEL_ADDRESS=${KERNEL_ADDRESS})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS -lstdc++)

include_directories(${CMAKE_SOURCE_DIR}/include)
Expand All @@ -24,11 +33,9 @@ add_library(${PROJECT} SHARED ${SRCS})

target_link_libraries(${PROJECT} PUBLIC spike_main)


set_target_properties(${PROJECT} PROPERTIES OUTPUT_NAME "${PROJECT}")
set_target_properties(${PROJECT} PROPERTIES CLEAN_DIRECT_OUTPUT 1)


add_executable(spike_test ./test.cpp)
add_dependencies(spike_test ${PROJECT})
target_link_libraries(spike_test PUBLIC ${PROJECT})
target_link_libraries(spike_test PUBLIC ${PROJECT})
6 changes: 5 additions & 1 deletion gpgpu-testcase/driver/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#include <iostream>
using namespace std;

#ifndef KERNEL_ADDRESS
#define KERNEL_ADDRESS 0x800000b8 // need modify
#endif

struct meta_data{ // 这个metadata是供驱动使用的,而不是给硬件的
uint64_t kernel_id;
uint64_t kernel_size[3];///> 每个kernel的workgroup三维数目
Expand Down Expand Up @@ -63,7 +67,7 @@ int main(){
meta.pdsBaseAddr=pdsbase;
uint32_t data_2[14];//metadata
for(int i=0;i<14;i++) data_2[i]=1;
data_2[0]=0x80000098;
data_2[0]=KERNEL_ADDRESS;
data_2[1]=(uint32_t)vaddr_4;
data_2[2]=meta.kernel_size[0];
data_2[6]=num_thread;
Expand Down

0 comments on commit 3db97c4

Please sign in to comment.