Skip to content

Commit 8763812

Browse files
authored
[Offload] Remove check on kernel argument sizes (#162121)
Summary: This check is unnecessarily restrictive and currently incorrectly fires for any size less than eight bytes. Just remove it, we do sanity checks elsewhere and at some point need to trust the ABI.
1 parent 839b91c commit 8763812

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

offload/plugins-nextgen/amdgpu/src/rtl.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3687,11 +3687,6 @@ Error AMDGPUKernelTy::launchImpl(GenericDeviceTy &GenericDevice,
36873687
KernelArgsTy &KernelArgs,
36883688
KernelLaunchParamsTy LaunchParams,
36893689
AsyncInfoWrapperTy &AsyncInfoWrapper) const {
3690-
if (ArgsSize != LaunchParams.Size &&
3691-
ArgsSize > LaunchParams.Size + getImplicitArgsSize())
3692-
return Plugin::error(ErrorCode::INVALID_ARGUMENT,
3693-
"invalid kernel arguments size");
3694-
36953690
AMDGPUPluginTy &AMDGPUPlugin =
36963691
static_cast<AMDGPUPluginTy &>(GenericDevice.Plugin);
36973692
AMDHostDeviceTy &HostDevice = AMDGPUPlugin.getHostDevice();

offload/unittests/OffloadAPI/device_code/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ add_offload_test_device_code(foo.cpp foo)
22
add_offload_test_device_code(bar.cpp bar)
33
# Compile with optimizations to eliminate AMDGPU implicit arguments.
44
add_offload_test_device_code(noargs.cpp noargs -O3)
5+
add_offload_test_device_code(byte.cpp byte)
56
add_offload_test_device_code(localmem.cpp localmem)
67
add_offload_test_device_code(localmem_reduction.cpp localmem_reduction)
78
add_offload_test_device_code(localmem_static.cpp localmem_static)
@@ -14,6 +15,7 @@ add_custom_target(offload_device_binaries DEPENDS
1415
foo.bin
1516
bar.bin
1617
noargs.bin
18+
byte.bin
1719
localmem.bin
1820
localmem_reduction.bin
1921
localmem_static.bin
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include <gpuintrin.h>
2+
3+
extern "C" __gpu_kernel void byte(unsigned char c) { (void)c; }

offload/unittests/OffloadAPI/kernel/olLaunchKernel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ struct LaunchSingleKernelTestBase : LaunchKernelTestBase {
5555

5656
KERNEL_TEST(Foo, foo)
5757
KERNEL_TEST(NoArgs, noargs)
58+
KERNEL_TEST(Byte, byte)
5859
KERNEL_TEST(LocalMem, localmem)
5960
KERNEL_TEST(LocalMemReduction, localmem_reduction)
6061
KERNEL_TEST(LocalMemStatic, localmem_static)

0 commit comments

Comments
 (0)