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

Function puzzle4

examples/gpu_puzzles/key.cpp:137–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135 }
136)";
137void puzzle4(Context &ctx) {
138 printf("\n\nPuzzle 4\n\n");
139 static constexpr size_t Wx = 3;
140 static constexpr size_t Wy = 3;
141 static constexpr size_t N = 2;
142 Tensor input = createTensor(ctx, {N, N}, kf32, makeData<N * N>().data());
143 Tensor output = createTensor(ctx, {N, N}, kf32);
144 struct Params {
145 uint32_t size = N;
146 };
147 Kernel op =
148 createKernel(ctx, {kPuzzle4, /*workgroup size*/ {Wx, Wy, 1}},
149 Bindings{input, output}, /* totalWorkgroups */ {1, 1, 1}, Params{N});
150 showResult<N, N, N>(ctx, op, output);
151}
152
153// Puzzle 5 : Broadcast
154// Implement a kernel that adds a and b and stores it in out. Inputs a and b

Callers 1

mainFunction · 0.70

Calls 2

createTensorFunction · 0.85
createKernelFunction · 0.85

Tested by

no test coverage detected