Skip to content

Commit

Permalink
The JS path on the Intel Mac failed in a weird way because I didn't i…
Browse files Browse the repository at this point in the history
…nclude the hack needed there
  • Loading branch information
dfellis committed Jan 8, 2025
1 parent dadf29c commit 39b543b
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion alan/src/compile/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,10 +837,40 @@ test_gpgpu!(gpu_determinant => r#"
);

test_gpgpu!(gpu_storage_barrier => r#"
export fn main {
export fn{Rs} main {
let id = gFor(3, 3);
let temp = GBuffer{f32}(9);
let out = GBuffer{f32}(9);
/*let compute = [
// Something that generates a buffer independently
temp[id.x + 3 * id.y].store((id.x.gf32 + id.y.gf32).asI32).build,
// Something that creates a new buffer based on the prior buffer
out[id.x + 3 * id.y].store(
((if(id.x > 0, temp[id.x - 1 + 3 * id.y].asF32, 0.0.gf32) +
temp[id.x + 3 * id.y].asF32 +
if(id.x < 2, temp[id.x + 1 + 3 * id.y].asF32, 0.0.gf32)) / 3.0).asI32).build
];
compute.run;*/
let compute = [
// Something that generates a buffer independently
temp[id.x + 3 * id.y].store((id.x.gf32 + id.y.gf32).asI32),
// Storage Barrier
storageBarrier(),
// Something that creates a new buffer based on the prior buffer
out[id.x + 3 * id.y].store(
((if(id.x > 0, temp[id.x - 1 + 3 * id.y].asF32, 0.0.gf32) +
temp[id.x + 3 * id.y].asF32 +
if(id.x < 2, temp[id.x + 1 + 3 * id.y].asF32, 0.0.gf32)) / 3.0).asI32)
].build.run;
//temp.read{f32}.map(fn (v: f32) = v.string(2)).join(", ").print;
out.read{f32}.map(fn (v: f32) = v.string(2)).join(", ").print;
}
export fn{Js} main {
let id = gFor(3, 3);
let temp = GBuffer{f32}(9);
let out = GBuffer{f32}(9);
// Hack to get this to work in JS, because the generic is not passed through there
{"((b) => { b.ValKind = alan_std.F32; })" :: GBuffer}(out);
/*let compute = [
// Something that generates a buffer independently
temp[id.x + 3 * id.y].store((id.x.gf32 + id.y.gf32).asI32).build,
Expand Down

0 comments on commit 39b543b

Please sign in to comment.