Skip to content
Open
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ hiprt/cache/KernelArgs.h
PUBLIC_OUT/
hiprt/impl/bvh_build_array.h
scripts/bitcodes/__pycache__/
test/common/meshes/lfs
test/common/meshes/lfs
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ if(WIN32)
target_link_libraries(${HIPRT_NAME} version)
endif()

if(WIN32 AND cuda_path)
target_link_libraries(${HIPRT_NAME} "${cuda_path}/lib/x64/cuda.lib" "${cuda_path}/lib/x64/cudart.lib")
endif()

target_include_directories(${HIPRT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${HIPRT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Orochi)
Expand Down Expand Up @@ -720,3 +723,16 @@ if(HIPRTEW)

target_compile_definitions(hiprtewtest PRIVATE GTEST_HAS_TR1_TUPLE=0)
endif()



# Fix hiprt03001 to find embree
target_include_directories(${HIPRT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/embree/include)
target_compile_definitions(${HIPRT_NAME} PRIVATE HIPEW_DO_NOT_CHECK_VERSION)
if(WIN32)
target_link_directories(${HIPRT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/embree/win)
target_link_libraries(${HIPRT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/contrib/embree/win/embree4.lib)
elseif(UNIX)
target_link_directories(${HIPRT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/embree/linux)
target_link_libraries(${HIPRT_NAME} embree4 tbb)
endif()
Binary file not shown.
8 changes: 8 additions & 0 deletions contrib/Orochi/Orochi/Orochi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@


#include <Orochi/Orochi.h>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <unordered_map>
Expand Down Expand Up @@ -844,6 +845,9 @@ int oroInitialize( oroApi api, oroU32 flags,
int e = 0;
s_loadedApis = 0;

if( api == ORO_API_AUTOMATIC )
api = (oroApi)(ORO_API_CUDA | ORO_API_HIP);

if( api & ORO_API_CUDA )
{
#ifdef OROCHI_ENABLE_CUEW
Expand Down Expand Up @@ -1154,7 +1158,11 @@ oroError OROAPI oroCtxCreate(oroCtx* pctx, unsigned int flags, oroDevice dev)
if( s_api & ORO_API_CUDADRIVER )
{
#ifdef OROCHI_ENABLE_CUEW
#if CUDA_VERSION >= 13000
CU4ORO::CUresult e = CU4ORO::cuCtxCreate( oroCtx2cu( pctx ), nullptr, flags, d.getDevice() );
#else
CU4ORO::CUresult e = CU4ORO::cuCtxCreate( oroCtx2cu( pctx ), flags, d.getDevice() );
#endif
if ( e != CU4ORO::CUDA_SUCCESS )
return cu2oro(e);
#endif
Expand Down
8 changes: 4 additions & 4 deletions contrib/Orochi/Orochi/enable_cuew.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ endfunction()
# Region generated by Orochi Summoner
#REGION_PREMAKE_START CudaPath

set(BEST_CUDA_VERSION_NAME "12.2")
set(BEST_CUDA_ENVVAR "CUDA_PATH_V12_2")
set(BEST_CUDA_PATH_LINUX "/usr/local/cuda-12.2")
set(BEST_CUDA_PATH_WINDOWS "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2")
set(BEST_CUDA_VERSION_NAME "13.0")
set(BEST_CUDA_ENVVAR "CUDA_PATH_V13_0")
set(BEST_CUDA_PATH_LINUX "/usr/local/cuda-13.0")
set(BEST_CUDA_PATH_WINDOWS "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0")
set(BACKUP_CUDA_ENVVAR "CUDA_PATH")
set(BACKUP_CUDA_PATH_LINUX "/usr/local/cuda")

Expand Down
30 changes: 30 additions & 0 deletions contrib/Orochi/Orochi/nvidia_hip_runtime_api_oro.h
Original file line number Diff line number Diff line change
Expand Up @@ -2250,14 +2250,20 @@ inline static hipError_t hipChooseDeviceR0600_cu4oro(int* device, const hipDevic
cdprop.regsPerBlock = prop->regsPerBlock;
cdprop.warpSize = prop->warpSize;
cdprop.maxThreadsPerBlock = prop->maxThreadsPerBlock;
#if CUDA_VERSION < 13000
cdprop.clockRate = prop->clockRate;
#endif
cdprop.totalConstMem = prop->totalConstMem;
cdprop.multiProcessorCount = prop->multiProcessorCount;
cdprop.l2CacheSize = prop->l2CacheSize;
cdprop.maxThreadsPerMultiProcessor = prop->maxThreadsPerMultiProcessor;
#if CUDA_VERSION < 13000
cdprop.computeMode = prop->computeMode;
#endif
cdprop.canMapHostMemory = prop->canMapHostMemory;
#if CUDA_VERSION < 13000
cdprop.memoryClockRate = prop->memoryClockRate;
#endif
cdprop.memoryBusWidth = prop->memoryBusWidth;
return hipCUDAErrorTohipError(cudaChooseDevice(device, &cdprop));
}
Expand Down Expand Up @@ -2635,21 +2641,31 @@ inline static hipError_t hipGetDevicePropertiesR0600_cu4oro(hipDeviceProp_t* p_p
p_prop->maxGridSize[0] = cdprop.maxGridSize[0];
p_prop->maxGridSize[1] = cdprop.maxGridSize[1];
p_prop->maxGridSize[2] = cdprop.maxGridSize[2];
#if CUDA_VERSION < 13000
p_prop->clockRate = cdprop.clockRate;
#endif
p_prop->totalConstMem = cdprop.totalConstMem;
p_prop->major = cdprop.major;
p_prop->minor = cdprop.minor;
p_prop->textureAlignment = cdprop.textureAlignment;
p_prop->texturePitchAlignment = cdprop.texturePitchAlignment;
#if CUDA_VERSION < 13000
p_prop->deviceOverlap = cdprop.deviceOverlap;
#endif
p_prop->multiProcessorCount = cdprop.multiProcessorCount;
#if CUDA_VERSION < 13000
p_prop->kernelExecTimeoutEnabled = cdprop.kernelExecTimeoutEnabled;
#endif
p_prop->integrated = cdprop.integrated;
p_prop->canMapHostMemory = cdprop.canMapHostMemory;
#if CUDA_VERSION < 13000
p_prop->computeMode = cdprop.computeMode;
#endif
p_prop->maxTexture1D = cdprop.maxTexture1D;
p_prop->maxTexture1DMipmap = cdprop.maxTexture1DMipmap;
#if CUDA_VERSION < 13000
p_prop->maxTexture1DLinear = cdprop.maxTexture1DLinear;
#endif
p_prop->maxTexture2D[0] = cdprop.maxTexture2D[0];
p_prop->maxTexture2D[1] = cdprop.maxTexture2D[1];
p_prop->maxTexture2DMipmap[0] = cdprop.maxTexture2DMipmap[0];
Expand Down Expand Up @@ -2696,7 +2712,9 @@ inline static hipError_t hipGetDevicePropertiesR0600_cu4oro(hipDeviceProp_t* p_p
p_prop->tccDriver = cdprop.tccDriver;
p_prop->asyncEngineCount = cdprop.asyncEngineCount;
p_prop->unifiedAddressing = cdprop.unifiedAddressing;
#if CUDA_VERSION < 13000
p_prop->memoryClockRate = cdprop.memoryClockRate;
#endif
p_prop->memoryBusWidth = cdprop.memoryBusWidth;
p_prop->l2CacheSize = cdprop.l2CacheSize;
p_prop->maxThreadsPerMultiProcessor = cdprop.maxThreadsPerMultiProcessor;
Expand All @@ -2709,13 +2727,17 @@ inline static hipError_t hipGetDevicePropertiesR0600_cu4oro(hipDeviceProp_t* p_p
p_prop->isMultiGpuBoard = cdprop.isMultiGpuBoard;
p_prop->multiGpuBoardGroupID = cdprop.multiGpuBoardGroupID;
p_prop->hostNativeAtomicSupported = cdprop.hostNativeAtomicSupported;
#if CUDA_VERSION < 13000
p_prop->singleToDoublePrecisionPerfRatio = cdprop.singleToDoublePrecisionPerfRatio;
#endif
p_prop->pageableMemoryAccess = cdprop.pageableMemoryAccess;
p_prop->concurrentManagedAccess = cdprop.concurrentManagedAccess;
p_prop->computePreemptionSupported = cdprop.computePreemptionSupported;
p_prop->canUseHostPointerForRegisteredMem = cdprop.canUseHostPointerForRegisteredMem;
p_prop->cooperativeLaunch = cdprop.cooperativeLaunch;
#if CUDA_VERSION < 13000
p_prop->cooperativeMultiDeviceLaunch = cdprop.cooperativeMultiDeviceLaunch;
#endif
p_prop->sharedMemPerBlockOptin = cdprop.sharedMemPerBlockOptin;
p_prop->pageableMemoryAccessUsesHostPageTables = cdprop.pageableMemoryAccessUsesHostPageTables;
p_prop->directManagedMemAccessFromHost = cdprop.directManagedMemAccessFromHost;
Expand Down Expand Up @@ -2871,7 +2893,11 @@ inline static hipError_t hipDeviceGetAttribute_cu4oro(int* pi, hipDeviceAttribut
cdattr = cudaDevAttrCooperativeLaunch;
break;
case hipDeviceAttributeCooperativeMultiDeviceLaunch:
#if CUDA_VERSION < 13000
cdattr = cudaDevAttrCooperativeMultiDeviceLaunch;
#else
cdattr = cudaDevAttrCooperativeLaunch;
#endif
break;
case hipDeviceAttributeHostRegisterSupported:
cdattr = cudaDevAttrHostRegisterSupported;
Expand Down Expand Up @@ -3331,7 +3357,11 @@ inline static hipError_t hipEventQuery_cu4oro(hipEvent_t event) {
}

inline static hipError_t hipCtxCreate_cu4oro(hipCtx_t* ctx, unsigned int flags, hipDevice_t device) {
#if CUDA_VERSION >= 13000
return hipCUResultTohipError(cuCtxCreate(ctx, nullptr, flags, device));
#else
return hipCUResultTohipError(cuCtxCreate(ctx, flags, device));
#endif
}

inline static hipError_t hipCtxDestroy_cu4oro(hipCtx_t ctx) {
Expand Down
9 changes: 5 additions & 4 deletions contrib/Orochi/contrib/cuew/src/cuew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ static DynamicLibrary nvrtc_lib = NULL;
// It's recommanded to use similar versions in the #include of CUDA SDK.
// If this assert is wrong, it's advised either to install a CUDA SDK closed to version 12020 or search on the Orochi github a branch matching the CUDA SDK you are using.
// checking the major-version number only:
static_assert( ((int)CUDA_VERSION / (int)1000) == ((int)12020/ (int)1000) );
static_assert( ((int)CUDART_VERSION / (int)1000) == ((int)12020/ (int)1000) );
static_assert( ((int)CUDA_VERSION / (int)1000) == ((int)12020/ (int)1000) || ((int)CUDA_VERSION / (int)1000) == ((int)13000/ (int)1000) );
static_assert( ((int)CUDART_VERSION / (int)1000) == ((int)12020/ (int)1000) || ((int)CUDART_VERSION / (int)1000) == ((int)13000/ (int)1000) );
#endif


Expand Down Expand Up @@ -862,7 +862,7 @@ static int cuewCudaInit(const char** customPaths_Cuda, const char** customPaths_
#ifdef _WIN32
// Expected in c:/windows/system or similar, no path needed.
const char *cuda_paths[] = {"nvcuda.dll", NULL};
const char *cudart_paths[] = {"cudart64_12.dll", NULL};
const char *cudart_paths[] = {"cudart64_13.dll", "cudart64_12.dll", NULL};
#elif defined(__APPLE__)
// Default installation path.
const char *cuda_paths[] = {"/usr/local/cuda/lib/libcuda.dylib", NULL};
Expand Down Expand Up @@ -1629,7 +1629,8 @@ static int cuewNvrtcInit(const char** customPaths_NvRTC)
/* Library paths. */
#ifdef _WIN32
/* Expected in c:/windows/system or similar, no path needed. */
const char* nvrtc_paths[] = {"nvrtc64_120_0.dll",
const char* nvrtc_paths[] = {"nvrtc64_130_0.dll",
"nvrtc64_120_0.dll",
"nvrtc64_112_0.dll",
"nvrtc64_101_0.dll",
"nvrtc64_100_0.dll",
Expand Down
Loading