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

Function puzzle5

examples/gpu_puzzles/run.cpp:156–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154 }
155)";
156void puzzle5(Context &ctx) {
157 printf("\n\nPuzzle 5\n\n");
158 static constexpr size_t N = 2;
159 static constexpr size_t Wx = 3;
160 static constexpr size_t Wy = 3;
161 Tensor a = createTensor(ctx, {N, 1}, kf32, makeData<N>().data());
162 Tensor b = createTensor(ctx, {1, N}, kf32, makeData<N>().data());
163 Tensor output = createTensor(ctx, {N, N}, kf32);
164 struct Params {
165 uint32_t size = N;
166 };
167
168 Kernel op =
169 createKernel(ctx, {kPuzzle5, /*workgroup size*/ {Wx, Wy, 1}},
170 Bindings{a, b, output}, {1, 1, 1}, Params{N});
171 showResult<N, N, N>(ctx, op, output);
172}
173
174// Puzzle 6 : Blocks
175// Implement a kernel that adds 10 to each position of a and stores it in out.

Callers

nothing calls this directly

Calls 2

createTensorFunction · 0.85
createKernelFunction · 0.85

Tested by

no test coverage detected