Open
Description
I observed something weird. When I try to launch the following kernel
#include <gpuintrin.h>
#include <math.h>
#include <stdlib.h>
extern "C" __gpu_kernel void applyLogf(const float *In, float *Out,
size_t NumElements) {
int Index = __gpu_num_threads(__GPU_X_DIM) * __gpu_block_id(__GPU_X_DIM) +
__gpu_thread_id(__GPU_X_DIM);
if (Index < NumElements) {
Out[Index] = logf(In[Index]);
}
}
with these arguments
// ...
struct {
void *InBuffer;
void *OutBuffer;
size_t NumElements;
} Args{InBuffer, OutBuffer, NumElements};
OL_CHECK(olLaunchKernel(nullptr, GPUDevice.Handle, Kernel, &Args,
sizeof(Args), &LaunchArgs, nullptr));
// ...
everything works fine. But if I try to change the type of NumElements
to int
, here
#include <gpuintrin.h>
#include <math.h>
extern "C" __gpu_kernel void applyLogf(const float *In, float *Out,
int NumElements) {
int Index = __gpu_num_threads(__GPU_X_DIM) * __gpu_block_id(__GPU_X_DIM) +
__gpu_thread_id(__GPU_X_DIM);
if (Index < NumElements) {
Out[Index] = logf(In[Index]);
}
}
and here
// ...
struct {
void *InBuffer;
void *OutBuffer;
int NumElements;
} Args{InBuffer, OutBuffer, static_cast<int>(NumElements)};
OL_CHECK(olLaunchKernel(nullptr, GPUDevice.Handle, Kernel, &Args,
sizeof(Args), &LaunchArgs, nullptr));
// ...
I get the following error:
OL_CHECK FAILED: (olLaunchKernel(nullptr, GPUDevice.Handle, Kernel, &Args, sizeof(Args), &LaunchArgs, nullptr)) != OL_SUCCESS
Error Code: 1
Details: error in cuLaunchKernel for 'applyLogf': too many resources requested for launch
Location: /home/leandro/offload-samples/samples/math_test/Tester.hpp:151
Function: check
Environment:
- LLVM version: Custom build from git
- LLVM Project Commit Hash:
1e4841881ef89aeee77cbf081de42af376bfa3fb
- LLVM Project Commit Hash:
- Operating System: Ubuntu 24.04.2 LTS (WSL2)