Skip to content

Commit 1ca6fa5

Browse files
committed
[Refactor] Update KernelLaunch to clarify CPU and GPU kernel launch logic (tile-ai#441)
* Added comments to distinguish between CPU and GPU kernel launch sections for better code readability. * Changed the creation of empty blocks to use a consistent "root" identifier, enhancing clarity in frame management.
1 parent 480477a commit 1ca6fa5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/ir.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ KernelLaunchFrame KernelLaunch(Array<PrimExpr> grid_size,
159159
attrs.defined() && attrs.count(tilelang_is_cpu_kernel_frame);
160160

161161
if (is_cpu_kernel_frame) {
162+
// Launch CPU Kernel
162163
ICHECK(grid_size.size() >= 0);
163164
ICHECK(block_size.size() == 0) << "CPU kernel cannot have block size";
164165
ICHECK(attrs.defined());
@@ -167,7 +168,6 @@ KernelLaunchFrame KernelLaunch(Array<PrimExpr> grid_size,
167168
n->frames.push_back(
168169
MakeIterVarFrame("block_var_" + std::to_string(i), grid_size[i]));
169170
}
170-
// Launch CPU Kernel
171171
} else {
172172
// Launch GPU Kernel
173173
ICHECK(grid_size.size() <= 3);
@@ -200,17 +200,15 @@ KernelLaunchFrame KernelLaunch(Array<PrimExpr> grid_size,
200200
CreateEnvThread("tz", "threadIdx.z", block_size[2].dtype()),
201201
block_size[2]));
202202
}
203-
} else {
204-
n->frames.push_back(Block(""));
205203
}
206204
}
207205

208206
if (attrs.defined()) {
209-
auto empty_block = Block("");
207+
auto empty_block = Block("root");
210208
empty_block->annotations = attrs;
211209
n->frames.push_back(empty_block);
212210
} else {
213-
n->frames.push_back(Block(""));
211+
n->frames.push_back(Block("root"));
214212
}
215213

216214
return KernelLaunchFrame(n);

0 commit comments

Comments
 (0)