Skip to content

Commit 7efffdb

Browse files
authored
[SYCLomatic] Migrate CU_LAUNCH_PARAM_* macros (#652)
Signed-off-by: Lu, John <[email protected]>
1 parent 153e836 commit 7efffdb

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

clang/lib/DPCT/MapNames.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4163,6 +4163,19 @@ std::unordered_map<std::string, MacroMigrationRule> MapNames::MacroRuleMap{
41634163
{"cudaStreamDefault",
41644164
MacroMigrationRule("cudaStreamDefault_rule", RulePriority::Fallback,
41654165
"cudaStreamDefault", "0")},
4166+
4167+
{"CU_LAUNCH_PARAM_BUFFER_SIZE",
4168+
MacroMigrationRule("kernel_param_rule", RulePriority::Fallback,
4169+
"CU_LAUNCH_PARAM_BUFFER_SIZE", "((void *) 2)",
4170+
HelperFeatureEnum::Kernel_kernel_library)},
4171+
{"CU_LAUNCH_PARAM_BUFFER_POINTER",
4172+
MacroMigrationRule("kernel_param_rule", RulePriority::Fallback,
4173+
"CU_LAUNCH_PARAM_BUFFER_POINTER", "((void *) 1)",
4174+
HelperFeatureEnum::Kernel_kernel_library)},
4175+
{"CU_LAUNCH_PARAM_END",
4176+
MacroMigrationRule("kernel_param_rule", RulePriority::Fallback,
4177+
"CU_LAUNCH_PARAM_END", "((void *) 0)",
4178+
HelperFeatureEnum::Kernel_kernel_library)},
41664179
//...
41674180
};
41684181

clang/test/dpct/module_main.cu

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// RUN: dpct --format-range=none -out-root %T/module_main %s --cuda-include-path="%cuda-path/include" -- -x cuda --cuda-host-only
22
// RUN: FileCheck %s --match-full-lines --input-file %T/module_main/module_main.dp.cpp
33

4+
//CHECK: #include <dpct/dpct.hpp>
5+
46
#include <string>
57
int main(){
68
//CHECK: dpct::kernel_library M;
@@ -28,6 +30,16 @@ int main(){
2830
//CHECK: F = dpct::get_kernel_function(M, FunctionName.c_str());
2931
cuModuleGetFunction(&F, M, FunctionName.c_str());
3032

33+
34+
int *argBuffer[3];
35+
size_t argBufferSize = sizeof(argBuffer);
36+
//CHECK: void *extra[] = {((void *) 2), &argBufferSize,
37+
//CHECK-NEXT: ((void *) 1), argBuffer,
38+
//CHECK-NEXT: ((void *) 0)};
39+
void *extra[] = {CU_LAUNCH_PARAM_BUFFER_SIZE, &argBufferSize,
40+
CU_LAUNCH_PARAM_BUFFER_POINTER, argBuffer,
41+
CU_LAUNCH_PARAM_END};
42+
3143
int sharedSize;
3244
CUstream s;
3345
void **param, **extra;

0 commit comments

Comments
 (0)