MCPcopy Create free account
hub / github.com/KnowingNothing/MatmulTutorial / GPUKernel

Class GPUKernel

util/simulator/kernel.py:158–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156
157
158class GPUKernel:
159 def __init__(self, grid: Dim3, cluster: Dim3, block: Dim3) -> None:
160 """
161 grid: grid config (how many blocks in grid)
162 cluster: cluster config (how many blocks in cluster)
163 block: block config (how many threads in block)
164 """
165 assert type(grid) == Dim3
166 assert type(cluster) == Dim3
167 assert type(block) == Dim3
168 self.grid = grid
169 self.cluster = cluster
170 self.block = block
171
172 def blockRange(self):
173 return Range3(
174 Arange(0, self.grid.x, 1, "blockx"), Arange(0, self.grid.y, 1, "blocky"), Arange(0, self.grid.z, 1, "blockz")
175 )
176
177 def threadRange(self):
178 return Range3(
179 Arange(0, self.block.x, 1, "threadx"), Arange(0, self.block.y, 1, "thready"), Arange(0, self.block.z, 1, "threadz")
180 )

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected