Skip to content
Merged
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
24 changes: 24 additions & 0 deletions deps/ReactantExtra/API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,26 @@ REACTANT_ABI void ReactantCudaDeviceGetProperties(DeviceProperties *jlprops,
jlprops->maxThreadsPerMultiProcessor = props.maxThreadsPerMultiProcessor;
}

REACTANT_ABI void ReactantCudaGetRegsSpillsMaxThreadsFromBinary(
const char *binary, const char *fnname, int32_t *regs, int32_t *spills,
int32_t *maxThreads) {
CUfunction fun;
CUmodule mod;

ReactantHandleCuResult(cuModuleLoadData(&mod, binary));
ReactantHandleCuResult(cuModuleGetFunction(&fun, mod, fnname));

ReactantHandleCuResult(
cuFuncGetAttribute(regs, CU_FUNC_ATTRIBUTE_NUM_REGS, fun));
ReactantHandleCuResult(
cuFuncGetAttribute(spills, CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES, fun));
*spills /= 4;
ReactantHandleCuResult(cuFuncGetAttribute(
maxThreads, CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, fun));

return;
}

#else

REACTANT_ABI int32_t ReactantCudaDriverGetVersion() { return 0; }
Expand All @@ -839,6 +859,10 @@ REACTANT_ABI int32_t ReactantCudaDeviceGetWarpSizeInThreads() { return 0; }
REACTANT_ABI void ReactantCudaDeviceGetProperties(DeviceProperties *jlprops,
int32_t device_id) {}

REACTANT_ABI void ReactantCudaGetRegsSpillsMaxThreadsFromBinary(
const char *binary, const char *fnname, int32_t *regs, int32_t *spills,
int32_t *maxThreads) {}

#endif

REACTANT_ABI void *UnsafeBufferPointer(PjRtBuffer *buffer) {
Expand Down
1 change: 1 addition & 0 deletions deps/ReactantExtra/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,7 @@ cc_library(
"-Wl,-exported_symbol,_ReactantCudaDeviceGetComputeCapalilityMinor",
"-Wl,-exported_symbol,_ReactantCudaDeviceGetWarpSizeInThreads",
"-Wl,-exported_symbol,_ReactantCudaDeviceGetProperties",
"-Wl,-exported_symbol,_ReactantCudaGetRegsSpillsMaxThreadsFromBinary",
"-Wl,-exported_symbol,_PjRtDeviceGetLocalDeviceId",
"-Wl,-exported_symbol,_PjRtDeviceGetGlobalDeviceId",
"-Wl,-exported_symbol,_PjRtDeviceGetLocalHardwareId",
Expand Down
Loading