#include "gpu.hpp"
#include "numeric_types/half.hpp"
#include
#include
#include
#include
using namespace gpu;
static constexpr auto twicePlusOne = R"(
@group(0) @binding(0) var input: array;
@group(0) @binding(1) var output: array;
@compute @workgroup_size({{workgroupSize}})
fn main(@builtin(global_invocation_id) id: vec3) {
if (id.x < arrayLength(&input)) {
output[id.x] = input[id.x] * 2 + 1;
}
}
)";
static constexpr auto doubleF16 = R"(
@group(0) @binding(0) var input: array;
@group(0) @binding(1) var output: array;
@compute @workgroup_size({{workgroupSize}})
fn main(@builtin(global_invocation_id) id: vec3) {
if (id.x < arrayLength(&input)) {
output[id.x] = input[id.x] * 2.0;
}
}
)";
static std::vector readSPIRV(const char *path) {
std::ifstream file(path, std::ios::binary | std::ios::ate);
if (!file) throw std::runtime_error("could not open assembled SPIR-V test");
const auto bytes = file.tellg();
if (bytes