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

Function puzzle4

examples/gpu_puzzles/run.cpp:122–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120 }
121)";
122void puzzle4(Context &ctx) {
123 printf("\n\nPuzzle 4\n\n");
124 static constexpr size_t Wx = 3;
125 static constexpr size_t Wy = 3;
126 static constexpr size_t N = 2;
127 Tensor input = createTensor(ctx, {N, N}, kf32, makeData<N * N>().data());
128 Tensor output = createTensor(ctx, {N, N}, kf32);
129 struct Params {
130 uint32_t size = N;
131 };
132 Kernel op =
133 createKernel(ctx, {kPuzzle4, /*workgroup size*/ {Wx, Wy, 1}},
134 Bindings{input, output}, /* nWorkgroups */ {1, 1, 1}, Params{N});
135 showResult<N, N, N>(ctx, op, output);
136}
137
138// Puzzle 5 : Broadcast
139// Implement a kernel that adds a and b and stores it in out. Inputs a and b

Callers

nothing calls this directly

Calls 2

createTensorFunction · 0.85
createKernelFunction · 0.85

Tested by

no test coverage detected