Skip to content

Commit 053a63a

Browse files
authored
[Ascend](fix) preserve hidden launch argument slots (#1722)
Keep the two reserved pure-SIMT scratch pointers null until scratch allocation support is ready. Always append the DTData slot, using nullptr when device printing is disabled, so both launch paths match the kernel ABI. Signed-off-by: Ritsuka314 <Ritsuka@huawei.com>
1 parent 6874b9b commit 053a63a

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

third_party/ascend/backend/driver.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,9 @@ def _make_kernel_launch(args_ptr, args_size, indent=" "):
13151315
size_t grid_offset = reserve_slot(sizeof(int32_t), 4);
13161316
reserve_slot(sizeof(int32_t), 4);
13171317
reserve_slot(sizeof(int32_t), 4);
1318-
{'size_t dtdata_offset = reserve_slot(sizeof(void*), 8);' if enable_device_print else ''}
1318+
{'reserve_slot(sizeof(void*), 8);' if metadata.is_pure_simt else ''}
1319+
{'reserve_slot(sizeof(void*), 8);' if metadata.is_pure_simt else ''}
1320+
{'size_t dtdata_offset = reserve_slot(sizeof(void*), 8);' if enable_device_print else 'reserve_slot(sizeof(void*), 8);'}
13191321
size_t total_size = args_offset;
13201322
13211323
std::vector<char> launch_args(total_size, 0);
@@ -1353,7 +1355,9 @@ def _make_kernel_launch(args_ptr, args_size, indent=" "):
13531355
{'void* workspace_addr __attribute__((aligned(8)));' if not metadata.is_pure_simt else ''}
13541356
{' '.join(f'{ty_to_cpp(ty)} arg{i} __attribute__((aligned({4 if ty[0] != "*" and ty[-2:] != "64" else 8})));' for i, ty in signature.items() if ty != "constexpr")}
13551357
{' '.join(f'{ty_to_cpp(ty)} grid{mark} __attribute__((aligned(4)));' for mark, ty in grid_info.items())}
1356-
{'void* DTData __attribute__((aligned(8)));' if enable_device_print else ''}
1358+
{'void* global_scratch __attribute__((aligned(8)));' if metadata.is_pure_simt else ''}
1359+
{'void* profile_scratch __attribute__((aligned(8)));' if metadata.is_pure_simt else ''}
1360+
{'void* DTData __attribute__((aligned(8)));'}
13571361
}} args = {{
13581362
{'static_cast<void*>(ffts_addr),' if target_support_ffts else ''}
13591363
{('static_cast<void*>(syncBlockLock_ptr),' if has_sync_block_lock else 'nullptr,') if not metadata.is_pure_simt else ''}
@@ -1362,7 +1366,9 @@ def _make_kernel_launch(args_ptr, args_size, indent=" "):
13621366
[f'static_cast<{ty_to_cpp(ty)}>(arg{i})' for i, ty in signature.items() if ty != "constexpr"]
13631367
)}
13641368
{', '.join(f'static_cast<{ty_to_cpp(ty)}>(grid{mark})' for mark, ty in grid_info.items())}
1365-
{', static_cast<void*>(DTData)' if enable_device_print else ''}
1369+
{', static_cast<void*>(nullptr)' if metadata.is_pure_simt else ''}
1370+
{', static_cast<void*>(nullptr)' if metadata.is_pure_simt else ''}
1371+
{', static_cast<void*>(DTData)' if enable_device_print else ', static_cast<void*>(nullptr)'}
13661372
}};
13671373
{_launch_lambda_post.replace('__KERNEL_LAUNCH_CALL__', cpp_kernel_launch_local)}
13681374

0 commit comments

Comments
 (0)