Skip to content

Commit

Permalink
[Task] More descriptive kernel names for nsys/ncu (#315)
Browse files Browse the repository at this point in the history
Co-authored-by: Allan Lin <allan.lin@centml.ai>
  • Loading branch information
Aalanli and Allan Lin committed Jul 16, 2023
1 parent 15426c8 commit 0c18446
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 6 additions & 1 deletion python/hidet/ir/schedulers/cpu/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ def schedule_grid_compute(self, node: GridCompute, tensor_map: Dict[TensorNode,

params, param_map, call_args = self.grid_compute_params_and_args(node, tensor_map)

with FunctionBuilder(name=f'compute_{node.name}', kind='cpu_kernel') as fb:
if self.task is not None:
name = f'{self.task.name}_compute_{node.name}'
else:
name = f'compute_{node.name}'

with FunctionBuilder(name=name, kind='cpu_kernel') as fb:
# set function parameters
fb.extend_params(params)

Expand Down
9 changes: 6 additions & 3 deletions python/hidet/ir/schedulers/cuda/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ def schedule_grid_compute(self, node: GridCompute, tensor_map: Dict[TensorNode,
block_dim = 512
grid_dim: Expr = (prod(node.shape) + block_dim - 1) // block_dim

with FunctionBuilder(
name=f'compute_{node.name}', kind='cuda_kernel', grid_dim=grid_dim, block_dim=block_dim
) as fb:
if self.task is not None:
name = f'{self.task.name}_compute_{node.name}'
else:
name = f'compute_{node.name}'

with FunctionBuilder(name=name, kind='cuda_kernel', grid_dim=grid_dim, block_dim=block_dim) as fb:
# set function parameters
fb.extend_params(params)

Expand Down

0 comments on commit 0c18446

Please sign in to comment.