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

Function puzzle7

examples/gpu_puzzles/key.cpp:257–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255 }
256)";
257void puzzle7(Context &ctx) {
258 printf("\n\nPuzzle 7\n\n");
259 static constexpr size_t N = 5;
260 static constexpr size_t Wx = 3;
261 static constexpr size_t Wy = 3;
262 static constexpr size_t Bx = 2;
263 static constexpr size_t By = 2;
264 Tensor a = createTensor(ctx, {N, N}, kf32, makeData<N * N>().data());
265 Tensor output = createTensor(ctx, {N, N}, kf32);
266 struct Params {
267 uint32_t size = N;
268 };
269
270 Kernel op =
271 createKernel(ctx, {kPuzzle7, {Wx, Wy, 1}},
272 Bindings{a, output}, {Bx, By, 1}, Params{N});
273 showResult<N, N, N>(ctx, op, output);
274}
275
276// Puzzle 8 : Shared
277// 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