Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ jobs:
image_tags:
- ubuntu-24.04-cuda-12.8-minimal
- ubuntu-22.04-cuda-11.7.1-minimal
include:
- app: rodinia_2.0-ft
config: TITANV-LOCALXBAR
image_tags: ubuntu-24.04-cuda-13.1.1-minimal
runs-on: ubuntu-latest
needs: check-format
name: build-CMake
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,7 @@ install(CODE "execute_process\(\
COMMAND ${CMAKE_COMMAND} -E create_symlink \
${GPGPUSIM_INSTALL_PATH}/$<TARGET_FILE_NAME:cudart> \
${GPGPUSIM_INSTALL_PATH}/$<TARGET_FILE_NAME:cudart>.12\)")
install(CODE "execute_process\(\
COMMAND ${CMAKE_COMMAND} -E create_symlink \
${GPGPUSIM_INSTALL_PATH}/$<TARGET_FILE_NAME:cudart> \
${GPGPUSIM_INSTALL_PATH}/$<TARGET_FILE_NAME:cudart>.13\)")
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ $(SIM_LIB_DIR)/libcudart.so: makedirs $(LIBS) cudalib
if [ ! -f $(SIM_LIB_DIR)/libcudart.so.10.1 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.10.1; fi
if [ ! -f $(SIM_LIB_DIR)/libcudart.so.11.0 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.11.0; fi
if [ ! -f $(SIM_LIB_DIR)/libcudart.so.12 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.12; fi
if [ ! -f $(SIM_LIB_DIR)/libcudart.so.13 ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart.so.13; fi
if [ ! -f $(SIM_LIB_DIR)/libcudart_mod.so ]; then ln -s libcudart.so $(SIM_LIB_DIR)/libcudart_mod.so; fi

$(SIM_LIB_DIR)/libcudart.dylib: makedirs $(LIBS) cudalib
Expand Down Expand Up @@ -273,4 +274,3 @@ cleangpgpusim: cleandocs
./cuobjdump_to_ptxplus/lex.ptx_.c ./cuobjdump_to_ptxplus/ptx.output ./cuobjdump_to_ptxplus/ptx.tab.h cuobjdump_to_ptxplus/ptx.tab.h \
./cuobjdump_to_ptxplus/sass_lexer.cc ./cuobjdump_to_ptxplus/sass_parser.cc ./cuobjdump_to_ptxplus/sass_parser.hh \
./cuobjdump_to_ptxplus/ptx.tab.cc ./cuobjdump_to_ptxplus/*.output

1 change: 1 addition & 0 deletions libcuda/cuda_api_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class kernel_config {
}
dim3 grid_dim() const { return m_GridDim; }
dim3 block_dim() const { return m_BlockDim; }
size_t shared_mem() const { return m_sharedMem; }
void set_grid_dim(dim3 *d) { m_GridDim = *d; }
void set_block_dim(dim3 *d) { m_BlockDim = *d; }
gpgpu_ptx_sim_arg_list_t get_args() { return m_args; }
Expand Down
47 changes: 43 additions & 4 deletions libcuda/cuda_runtime_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ struct _cuda_device_id *gpgpu_context::GPGPUSim_Init() {
prop->sharedMemPerBlock = the_gpu->shared_mem_per_block();
prop->regsPerBlock = the_gpu->num_registers_per_block();
prop->warpSize = the_gpu->wrp_size();
#if (CUDART_VERSION < 13000)
prop->clockRate = the_gpu->shader_clock();
#endif
#if (CUDART_VERSION >= 2010)
prop->multiProcessorCount = the_gpu->get_config().num_shader();
#endif
Expand Down Expand Up @@ -1792,8 +1794,8 @@ cudaDeviceGetAttributeInternal(int *value, enum cudaDeviceAttr attr, int device,
case 12:
*value = prop->regsPerBlock;
break;
case 13:
*value = 1480000; // for 1080ti
case cudaDevAttrClockRate:
*value = dev->get_gpgpu()->shader_clock();
break;
case 14:
*value = prop->textureAlignment;
Expand Down Expand Up @@ -2052,9 +2054,7 @@ __host__ cudaError_t CUDARTAPI cudaLaunchKernelInternal(
}
CUctx_st *context = GPGPUSim_Context(ctx);
function_info *entry = context->get_kernel(hostFun);
#if CUDART_VERSION < 10000

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably here to ensure that sub 10 CUDAs work.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before I changed it new CUDA launch relied on __cudaPopCallConfiguration() being no-op. Meaning that the launch config would sit on g_cuda_launch-stack, so that cudaLaunchKernelInternal() did not need to call cudaConfigureCallInternal() for CUDART_VERSION >= 10000, you can check this from before my changes in libcuda/cuda_runtime_api.cc in line 2042.

I made __cudaPopCallConfiguration() to actually take the saved launch config and return gridDim, blockDim, sharedMem, stream, which is what newer CUDA expects. The modern pattern is __cudaPushCallConfiguration(..) -> __cudaPopCallConfiguration(...) -> cudaLaunchKernel(...).

To further clarify, when __cudaPopCallConfiguration(), cudaLaunchKernelInternal() then must rebuild the launch state, which is why the call is unconditional. So we did not remove support for < 10 CUDA, we just made the path consistent. I also reran the 11.7 lane after this, and it passed with short-tests-cmake.sh 10/10.

cudaConfigureCallInternal(gridDim, blockDim, sharedMem, stream, ctx);
#endif
for (unsigned i = 0; i < entry->num_args(); i++) {
std::pair<size_t, unsigned> p = entry->get_param_config(i);
cudaSetupArgumentInternal(args[i], p.first, p.second);
Expand Down Expand Up @@ -2946,6 +2946,15 @@ __host__ cudaError_t CUDARTAPI cudaLaunch(const char *hostFun) {
return cudaLaunchInternal(hostFun);
}

__host__ cudaError_t CUDARTAPI cudaGetKernel(void **kernelPtr,
const void *entryFuncAddr) {
if (g_debug_execution >= 3) {
announce_call(__my_func__);
}
*kernelPtr = (void *)entryFuncAddr;
return g_last_cudaError = cudaSuccess;
}

__host__ cudaError_t CUDARTAPI cudaLaunchKernel(const char *hostFun,
dim3 gridDim, dim3 blockDim,
const void **args,
Expand Down Expand Up @@ -3923,9 +3932,39 @@ cudaError_t CUDARTAPI __cudaPopCallConfiguration(dim3 *gridDim, dim3 *blockDim,
if (g_debug_execution >= 3) {
announce_call(__my_func__);
}
gpgpu_context *ctx = GPGPU_Context();
gpgpusim_ptx_assert(!ctx->api->g_cuda_launch_stack.empty(),
"empty launch stack");
kernel_config config = ctx->api->g_cuda_launch_stack.back();
ctx->api->g_cuda_launch_stack.pop_back();
if (gridDim) *gridDim = config.grid_dim();
if (blockDim) *blockDim = config.block_dim();
if (sharedMem) *sharedMem = config.shared_mem();
if (stream) *(struct CUstream_st **)stream = config.get_stream();
return g_last_cudaError = cudaSuccess;
}

cudaError_t CUDARTAPI __cudaGetKernel(void **kernelPtr,
const void *entryFuncAddr) {
return cudaGetKernel(kernelPtr, entryFuncAddr);
}

cudaError_t CUDARTAPI __cudaLaunchKernel(const void *kernel, dim3 gridDim,
dim3 blockDim, void **args,
size_t sharedMem,
cudaStream_t stream) {
return cudaLaunchKernelInternal((const char *)kernel, gridDim, blockDim,
(const void **)args, sharedMem, stream);
}

cudaError_t CUDARTAPI __cudaLaunchKernel_ptsz(const void *kernel, dim3 gridDim,
dim3 blockDim, void **args,
size_t sharedMem,
cudaStream_t stream) {
return __cudaLaunchKernel(kernel, gridDim, blockDim, args, sharedMem,
stream);
}

void CUDARTAPI __cudaRegisterFunctionSST(unsigned fatCubinHandle,
uint64_t hostFun,
char deviceFun[512]) {
Expand Down
2 changes: 2 additions & 0 deletions linux-so-version.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ libcudart.so.11.0{
};
libcudart.so.12{
};
libcudart.so.13{
};
libcuda.so.1{
};
Loading