MCPcopy Create free account
hub / github.com/AnswerDotAI/gpu.cpp / puzzle5

Function puzzle5

examples/gpu_puzzles/key.cpp:176–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174 }
175)";
176void puzzle5(Context &ctx) {
177 printf("\n\nPuzzle 5\n\n");
178 static constexpr size_t N = 2;
179 static constexpr size_t Wx = 3;
180 static constexpr size_t Wy = 3;
181 Tensor a = createTensor(ctx, {N, 1}, kf32, makeData<N>().data());
182 Tensor b = createTensor(ctx, {1, N}, kf32, makeData<N>().data());
183 Tensor output = createTensor(ctx, {N, N}, kf32);
184 struct Params {
185 uint32_t size = N;
186 };
187
188 Kernel op =
189 createKernel(ctx, {kPuzzle5, /*workgroup size*/ {Wx, Wy, 1}},
190 Bindings{a, b, output}, {1, 1, 1}, Params{N});
191 showResult<N, N, N>(ctx, op, output);
192}
193
194// Puzzle 6 : Blocks
195// Implement a kernel that adds 10 to each position of a and stores it in out.

Callers 1

mainFunction · 0.70

Calls 2

createTensorFunction · 0.85
createKernelFunction · 0.85

Tested by

no test coverage detected