denosaurs/neo

GPU wgsl code error

erfanium opened this issue · 4 comments

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

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 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?

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

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