shader-slang / slang-python

Superseded by github.com/shader-slang/slang-torch
MIT License
26 stars 3 forks source link

cuda_matmul_prelude.cuh #14

Open nvidia-beer opened 7 months ago

nvidia-beer commented 7 months ago

I am getting an error when I am running python mlp_image_fit.py (see bellow)

To recreate: build docker:

docker build -t slang-python .

with Dockerfile:

FROM nvcr.io/nvidia/pytorch:23.10-py3
WORKDIR /
RUN git clone https://github.com/shader-slang/slang-python.git
WORKDIR /slang-python
RUN apt-get update
RUN apt-get install -y python3.10-venv
COPY build-package.sh .
RUN bash ./build-package.sh
WORKDIR /slang-python/dist
RUN pip install *.whl
WORKDIR /slang-python/
RUN apt-get install -y ffmpeg 

and with build-package.sh file (same directory):

wget https://github.com/shader-slang/slang/releases/download/v2023.4.9/slang-2023.4.9-linux-x86_64.zip
LINUX64ZIP=slang-2023.4.9-linux-x86_64.zip
mkdir -p ./tmp
echo "extracting $LINUX64ZIP"
unzip -n $LINUX64ZIP -d ./tmp
mkdir -p ./slangpy/bin/
cp ./tmp/bin/linux-x64/release/libslang.so ./slangpy/bin/libslang.so
cp ./tmp/bin/linux-x64/release/slangc ./slangpy/bin/slangc
chmod +x ./slangpy/bin/slangc
echo "content of ./slangpy/bin/:"
ls ./slangpy/bin/
rm $LINUX64ZIP
rm -rf ./tmp/
python -m pip install --upgrade pip
pip install build hatchling
python -m build

you will get the following error

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(25): error: name followed by "::" must be a class or namespace name
     nvcuda::wmma::fragment<nvcuda::wmma::matrix_a, M, N, K, nvcuda::wmma::precision::tf32, nvcuda::wmma::row_major> a_frag;
     ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(25): error: name followed by "::" must be a class or namespace name
     nvcuda::wmma::fragment<nvcuda::wmma::matrix_a, M, N, K, nvcuda::wmma::precision::tf32, nvcuda::wmma::row_major> a_frag;
                                                             ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(25): error: name followed by "::" must be a class or namespace name
     nvcuda::wmma::fragment<nvcuda::wmma::matrix_a, M, N, K, nvcuda::wmma::precision::tf32, nvcuda::wmma::row_major> a_frag;
                                                                                            ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(25): error: identifier "a_frag" is undefined
     nvcuda::wmma::fragment<nvcuda::wmma::matrix_a, M, N, K, nvcuda::wmma::precision::tf32, nvcuda::wmma::row_major> a_frag;
                                                                                                                     ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(26): error: name followed by "::" must be a class or namespace name
     nvcuda::wmma::fragment<nvcuda::wmma::matrix_b, M, N, K, nvcuda::wmma::precision::tf32, nvcuda::wmma::col_major> b_frag;
     ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(26): error: name followed by "::" must be a class or namespace name
     nvcuda::wmma::fragment<nvcuda::wmma::matrix_b, M, N, K, nvcuda::wmma::precision::tf32, nvcuda::wmma::col_major> b_frag;
                                                             ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(26): error: name followed by "::" must be a class or namespace name
     nvcuda::wmma::fragment<nvcuda::wmma::matrix_b, M, N, K, nvcuda::wmma::precision::tf32, nvcuda::wmma::col_major> b_frag;
                                                                                            ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(26): error: identifier "b_frag" is undefined
     nvcuda::wmma::fragment<nvcuda::wmma::matrix_b, M, N, K, nvcuda::wmma::precision::tf32, nvcuda::wmma::col_major> b_frag;
                                                                                                                     ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(27): error: name followed by "::" must be a class or namespace name
     nvcuda::wmma::fragment<nvcuda::wmma::accumulator, M, N, K, float> acc_frag;
     ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(27): error: type name is not allowed
     nvcuda::wmma::fragment<nvcuda::wmma::accumulator, M, N, K, float> acc_frag;
                                                                ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(27): error: identifier "acc_frag" is undefined
     nvcuda::wmma::fragment<nvcuda::wmma::accumulator, M, N, K, float> acc_frag;
                                                                       ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(45): error: name followed by "::" must be a class or namespace name
           nvcuda::wmma::fill_fragment(acc_frag, 0.0f);
           ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(54): error: name followed by "::" must be a class or namespace name
              nvcuda::wmma::load_matrix_sync(a_frag, in + tk + ti * lda, lda);
              ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(55): error: name followed by "::" must be a class or namespace name
              nvcuda::wmma::load_matrix_sync(b_frag, wt + tk + tj * ldb, ldb);
              ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(59): error: name followed by "::" must be a class or namespace name
                 a_frag.x[t] = nvcuda::wmma::__float_to_tf32(a_frag.x[t]);
                               ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(63): error: name followed by "::" must be a class or namespace name
                 b_frag.x[t] = nvcuda::wmma::__float_to_tf32(b_frag.x[t]);
                               ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(66): error: name followed by "::" must be a class or namespace name
              nvcuda::wmma::mma_sync(acc_frag, a_frag, b_frag, acc_frag);
              ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(70): error: name followed by "::" must be a class or namespace name
           nvcuda::wmma::store_matrix_sync(out + tj + ti * O, acc_frag, O, nvcuda::wmma::mem_row_major);
           ^

/slang-python/examples/inline-mlp-example/cuda_matmul_prelude.cuh(70): error: name followed by "::" must be a class or namespace name
           nvcuda::wmma::store_matrix_sync(out + tj + ti * O, acc_frag, O, nvcuda::wmma::mem_row_major);
                                                                           ^

19 errors detected in the compilation of "/slang-python/examples/inline-mlp-example/.slangpy_cache/image-model/1426d7b0fdc875a7/image-model_cuda.cu".
ninja: build stopped: subcommand failed.
saipraveenb25 commented 2 months ago

@nvidia-beer: Is still an issue? I will close the issue otherwise.

nvidia-beer commented 2 months ago

no not an issue