Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU wgsl code error #25

Closed
erfanium opened this issue Aug 9, 2022 · 4 comments · Fixed by #26
Closed

GPU wgsl code error #25

erfanium opened this issue Aug 9, 2022 · 4 comments · Fixed by #26

Comments

@erfanium
Copy link

erfanium commented Aug 9, 2022

Supported features: depth-clip-control, texture-compression-bc, texture-compression-etc2, texture-compression-astc, address-mode-clamp-to-border, texture-adapter-specific-format-features, clear-texture
error: Uncaught (in promise) WebGPUValidationError: 
Shader '' parsing error: expected ',', found ';'
  ┌─ wgsl:3:17
  │
3 │   inputSize: u32;
  │                 ^ expected ','

: expected ',', found ';'
      const err = new Error(error.value ?? "unknown");
                  ^
    at InnerGPUDevice.proto.pushError (https://crux.land/api/get/4ZZB5m.ts:7:19)
    at GPUDevice.createShaderModule (deno:ext/webgpu/01_webgpu.js:1237:14)
    at WebGPUBackend.register (https://raw.githubusercontent.com/denosaurs/neo/main/backend/webgpu/backend.ts:52:32)
    at feedForward (https://deno.land/x/netsaur@0.1.1/src/gpu/kernels/feedforward.ts:19:34)
    at BaseGPULayer.feedForward (https://deno.land/x/netsaur@0.1.1/src/gpu/layers/base.ts:118:11)
    at GPUNetwork.feedForward (https://deno.land/x/netsaur@0.1.1/src/gpu/network.ts:51:27)
    at GPUNetwork.train (https://deno.land/x/netsaur@0.1.1/src/gpu/network.ts:111:20)
    at async NeuralNetwork.train (https://deno.land/x/netsaur@0.1.1/src/mod.ts:60:5)
    at async file:///home/erfanium/Documents/deno_mnist/sample.ts:28:1

Code:

import { NeuralNetwork } from "https://deno.land/x/netsaur@0.1.1/mod.ts";
import { DataSet } from "https://deno.land/x/netsaur@0.1.1/src/types.ts";
import { loadTest, loadTrain } from "./loader.ts";

const [x, y] = await loadTrain("data");
const trainData: DataSet[] = [];

for (let i = 0; i < 10; i++) {
  trainData.push({
    inputs: x[i],
    outputs: [y[i] / 10],
  });
}

const net = await new NeuralNetwork({
  hidden: [
    { size: 10, activation: "sigmoid" },
  ],
  cost: "crossentropy",
  output: { size: 1, activation: "sigmoid" },
  input: {
    type: "f32",
  },
  silent: false,
}).setupBackend(true, false);

await net.train(
  trainData,
  200,
  1,
  0.1,
);

deno 1.24.2

@eliassjogreen
Copy link
Member

Probably due to an recent internal update of naga/wgpu in deno. I will try to get around to fixing it and any other wgsl errors when i get back from my vacation.

@eliassjogreen eliassjogreen linked a pull request Aug 20, 2022 that will close this issue
@erfanium
Copy link
Author

@eliassjogreen thank you for the fix but /x/netsaur is broke now.

error: Module not found "https://raw.githubusercontent.com/denosaurs/neo/main/backend/util.ts".
    at https://deno.land/x/netsaur@0.1.1/deps.ts:6:28

Can you publish a newer version?

@eliassjogreen
Copy link
Member

This is an issue with Netsaur being unstable and not using the neo api directly. @load1n9 mind looking into this?

@load1n9
Copy link
Member

load1n9 commented Aug 20, 2022

Webgpu in netsaur is still unstable and we're working on fixing that, will look more into it when I get home in 2 weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants