Skip to content

Commit

Permalink
revert(#13402): experiment: wgpu sync (#13439)
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronO authored Jan 20, 2022
1 parent 1cc38f5 commit 3ab68bd
Show file tree
Hide file tree
Showing 24 changed files with 1,904 additions and 704 deletions.
94 changes: 51 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fn create_compiler_snapshot(
op_crate_libs.insert("deno.url", deno_url::get_declaration());
op_crate_libs.insert("deno.web", deno_web::get_declaration());
op_crate_libs.insert("deno.fetch", deno_fetch::get_declaration());
op_crate_libs.insert("deno.webgpu", deno_webgpu_get_declaration());
op_crate_libs.insert("deno.webgpu", deno_webgpu::get_declaration());
op_crate_libs.insert("deno.websocket", deno_websocket::get_declaration());
op_crate_libs.insert("deno.webstorage", deno_webstorage::get_declaration());
op_crate_libs.insert("deno.crypto", deno_crypto::get_declaration());
Expand Down Expand Up @@ -322,7 +322,7 @@ fn main() {
);
println!(
"cargo:rustc-env=DENO_WEBGPU_LIB_PATH={}",
deno_webgpu_get_declaration().display()
deno_webgpu::get_declaration().display()
);
println!(
"cargo:rustc-env=DENO_WEBSOCKET_LIB_PATH={}",
Expand Down Expand Up @@ -369,11 +369,6 @@ fn main() {
}
}

fn deno_webgpu_get_declaration() -> PathBuf {
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
manifest_dir.join("dts").join("lib.deno_webgpu.d.ts")
}

fn get_js_files(d: &str) -> Vec<PathBuf> {
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let mut js_files = std::fs::read_dir(d)
Expand Down
5 changes: 1 addition & 4 deletions cli/tests/testdata/webgpu_computepass_shader.wgsl
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[[block]]
struct PrimeIndices {
data: [[stride(4)]] array<u32>;
}; // this is used as both input and output for convenience

[[group(0), binding(0)]]
var<storage, read_write> v_indices: PrimeIndices;

// The Collatz Conjecture states that for any integer n:
// If n is even, n = n/2
// If n is odd, n = 3n+1
Expand All @@ -26,14 +25,12 @@ fn collatz_iterations(n_base: u32) -> u32{
if (n >= 1431655765u) { // 0x55555555u
return 4294967295u; // 0xffffffffu
}

n = 3u * n + 1u;
}
i = i + 1u;
}
return i;
}

[[stage(compute), workgroup_size(1)]]
fn main([[builtin(global_invocation_id)]] global_id: vec3<u32>) {
v_indices.data[global_id.x] = collatz_iterations(v_indices.data[global_id.x]);
Expand Down
5 changes: 2 additions & 3 deletions cli/tests/unit/webgpu_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ Deno.test({

const stagingBuffer = device.createBuffer({
size: size,
usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST,
usage: 1 | 8,
});

const storageBuffer = device.createBuffer({
label: "Storage Buffer",
size: size,
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST |
GPUBufferUsage.COPY_SRC,
usage: 0x80 | 8 | 4,
mappedAtCreation: true,
});

Expand Down
49 changes: 6 additions & 43 deletions ext/webgpu/01_webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3060,48 +3060,6 @@
device.pushError(err);
}

/**
* @param {GPUBuffer} destination
* @param {GPUSize64} destinationOffset
* @param {GPUSize64} size
*/
clearBuffer(destination, destinationOffset, size) {
webidl.assertBranded(this, GPUCommandEncoder);
const prefix = "Failed to execute 'clearBuffer' on 'GPUCommandEncoder'";
webidl.requiredArguments(arguments.length, 3, { prefix });
destination = webidl.converters.GPUBuffer(destination, {
prefix,
context: "Argument 1",
});
destinationOffset = webidl.converters.GPUSize64(destinationOffset, {
prefix,
context: "Argument 2",
});
size = webidl.converters.GPUSize64(size, {
prefix,
context: "Argument 3",
});
const device = assertDevice(this, { prefix, context: "this" });
const commandEncoderRid = assertResource(this, {
prefix,
context: "this",
});
const destinationRid = assertResource(destination, {
prefix,
context: "Argument 1",
});
const { err } = core.opSync(
"op_webgpu_command_encoder_clear_buffer",
{
commandEncoderRid,
destinationRid,
destinationOffset,
size,
},
);
device.pushError(err);
}

/**
* @param {string} groupLabel
*/
Expand Down Expand Up @@ -3245,7 +3203,7 @@
prefix,
context: "Argument 3",
});
destination = webidl.converters.GPUBuffer(destination, {
destination = webidl.converters.GPUQuerySet(destination, {
prefix,
context: "Argument 4",
});
Expand Down Expand Up @@ -4569,10 +4527,15 @@
webidl.illegalConstructor();
}

get executionTime() {
throw new Error("Not yet implemented");
}

[SymbolFor("Deno.privateCustomInspect")](inspect) {
return `${this.constructor.name} ${
inspect({
label: this.label,
// TODO(crowlKats): executionTime
})
}`;
}
Expand Down
Loading

0 comments on commit 3ab68bd

Please sign in to comment.