shader-slang / slang-python

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

how to use determinant function from slang in a slangpy kernel. #19

Closed chinmay0301ucsd closed 8 months ago

chinmay0301ucsd commented 8 months ago
// Compute determinant function
[AutoPyBindCUDA]
[CUDAKernel]
[Differentiable]
void compute_determinant(DiffTensorView mat, DiffTensorView output) {
    matrix<float, N, N> mat_s;
    float det;
    [MaxIters(N)]
    for (int i = 0; i < N; i++) {
        [MaxIters(N)]
        for (int j = 0; j < N; j++) {
            mat_s[i][j] = mat[i, j];
        }
    }
    output[0] = determinant(mat_s);

N is defined correctly as a static compile time constant.

I get the following error message on trying to load this function - Essentially in the .cu file, the slang determinant function is not accessible. Is there a way around this, other than writing my own determinant function in the .slang file?

{
    "name": "RuntimeError",
    "message": "Error building extension '_slangpy_bezier_compute_44136fa355b3678a': [1/3] /usr/local/cuda-11.7/bin/nvcc  -DTORCH_EXTENSION_NAME=_slangpy_bezier_compute_44136fa355b3678a -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\\\"_gcc\\\" -DPYBIND11_STDLIB=\\\"_libstdcpp\\\" -DPYBIND11_BUILD_ABI=\\\"_cxxabi1011\\\" -I/home/ubuntu/slang-python/examples/bezier2d -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda-11.7/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++17 -c /home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu -o bezier_compute_cuda.cuda.o \nFAILED: bezier_compute_cuda.cuda.o \n/usr/local/cuda-11.7/bin/nvcc  -DTORCH_EXTENSION_NAME=_slangpy_bezier_compute_44136fa355b3678a -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\\\"_gcc\\\" -DPYBIND11_STDLIB=\\\"_libstdcpp\\\" -DPYBIND11_BUILD_ABI=\\\"_cxxabi1011\\\" -I/home/ubuntu/slang-python/examples/bezier2d -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda-11.7/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++17 -c /home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu -o bezier_compute_cuda.cuda.o \n/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu(2372): warning #550-D: variable \"oldVal_0\" was set but never used\n\n/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu(2379): warning #550-D: variable \"oldVal_1\" was set but never used\n\n/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu(3036): error: identifier \"determinant\" is undefined\n\n/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu(3517): error: identifier \"determinant\" is undefined\n\n2 errors detected in the compilation of \"/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu\".\n[2/3] c++ -MMD -MF bezier_compute.o.d -DTORCH_EXTENSION_NAME=_slangpy_bezier_compute_44136fa355b3678a -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\\\"_gcc\\\" -DPYBIND11_STDLIB=\\\"_libstdcpp\\\" -DPYBIND11_BUILD_ABI=\\\"_cxxabi1011\\\" -I/home/ubuntu/slang-python/examples/bezier2d -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda-11.7/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -std=c++17 -c /home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute.cpp -o bezier_compute.o \n/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute.cpp:8398:9: warning: #pragma once in main file\n 8398 | #pragma once\n      |         ^~~~\nninja: build stopped: subcommand failed.\n",
    "stack": "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mCalledProcessError\u001b[0m                        Traceback (most recent call last)\nFile \u001b[0;32m~/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/utils/cpp_extension.py:1900\u001b[0m, in \u001b[0;36m_run_ninja_build\u001b[0;34m(build_directory, verbose, error_prefix)\u001b[0m\n\u001b[1;32m   1899\u001b[0m     stdout_fileno \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m\n\u001b[0;32m-> 1900\u001b[0m     \u001b[43msubprocess\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m   1901\u001b[0m \u001b[43m        \u001b[49m\u001b[43mcommand\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1902\u001b[0m \u001b[43m        \u001b[49m\u001b[43mstdout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstdout_fileno\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mverbose\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43msubprocess\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mPIPE\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1903\u001b[0m \u001b[43m        \u001b[49m\u001b[43mstderr\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msubprocess\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mSTDOUT\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1904\u001b[0m \u001b[43m        \u001b[49m\u001b[43mcwd\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbuild_directory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1905\u001b[0m \u001b[43m        \u001b[49m\u001b[43mcheck\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m   1906\u001b[0m \u001b[43m        \u001b[49m\u001b[43menv\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43menv\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   1907\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m subprocess\u001b[38;5;241m.\u001b[39mCalledProcessError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m   1908\u001b[0m     \u001b[38;5;66;03m# Python 2 and 3 compatible way of getting the error object.\u001b[39;00m\n\nFile \u001b[0;32m~/anaconda3/envs/gaussian_splatting/lib/python3.8/subprocess.py:516\u001b[0m, in \u001b[0;36mrun\u001b[0;34m(input, capture_output, timeout, check, *popenargs, **kwargs)\u001b[0m\n\u001b[1;32m    515\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m check \u001b[38;5;129;01mand\u001b[39;00m retcode:\n\u001b[0;32m--> 516\u001b[0m         \u001b[38;5;28;01mraise\u001b[39;00m CalledProcessError(retcode, process\u001b[38;5;241m.\u001b[39margs,\n\u001b[1;32m    517\u001b[0m                                  output\u001b[38;5;241m=\u001b[39mstdout, stderr\u001b[38;5;241m=\u001b[39mstderr)\n\u001b[1;32m    518\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m CompletedProcess(process\u001b[38;5;241m.\u001b[39margs, retcode, stdout, stderr)\n\n\u001b[0;31mCalledProcessError\u001b[0m: Command '['ninja', '-v']' returned non-zero exit status 1.\n\nThe above exception was the direct cause of the following exception:\n\n\u001b[0;31mRuntimeError\u001b[0m                              Traceback (most recent call last)\nCell \u001b[0;32mIn [12], line 4\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mtorch\u001b[39;00m\n\u001b[1;32m      2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mslangpy\u001b[39;00m\n\u001b[0;32m----> 4\u001b[0m m \u001b[38;5;241m=\u001b[39m \u001b[43mslangpy\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloadModule\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mbezier_compute.slang\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m      6\u001b[0m N \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1000\u001b[39m\n\u001b[1;32m      7\u001b[0m t \u001b[38;5;241m=\u001b[39m torch\u001b[38;5;241m.\u001b[39mlinspace(\u001b[38;5;241m0.0\u001b[39m,\u001b[38;5;241m1\u001b[39m,N, dtype\u001b[38;5;241m=\u001b[39mtorch\u001b[38;5;241m.\u001b[39mfloat)\u001b[38;5;241m.\u001b[39mcuda()\n\nFile \u001b[0;32m~/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/slangpy/slangpy.py:616\u001b[0m, in \u001b[0;36mloadModule\u001b[0;34m(fileName, skipSlang, verbose, defines, includePaths)\u001b[0m\n\u001b[1;32m    613\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m verbose:\n\u001b[1;32m    614\u001b[0m         \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWorking folder: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mbuildDir\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m, file\u001b[38;5;241m=\u001b[39msys\u001b[38;5;241m.\u001b[39mstderr)\n\u001b[0;32m--> 616\u001b[0m     rawModule \u001b[38;5;241m=\u001b[39m \u001b[43m_loadModule\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfileName\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmoduleName\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuildDir\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msourceDir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moutputFolder\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mverbose\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mverbose\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mincludePaths\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mincludePaths\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdryRun\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m    617\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m wrapModule(rawModule)\n\nFile \u001b[0;32m~/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/slangpy/slangpy.py:535\u001b[0m, in \u001b[0;36m_loadModule\u001b[0;34m(fileName, moduleName, outputFolder, options, sourceDir, verbose, includePaths, dryRun)\u001b[0m\n\u001b[1;32m    532\u001b[0m \u001b[38;5;66;03m# Compile host and kernel modules to torch module.\u001b[39;00m\n\u001b[1;32m    533\u001b[0m downstreamStartTime \u001b[38;5;241m=\u001b[39m time\u001b[38;5;241m.\u001b[39mperf_counter()\n\u001b[0;32m--> 535\u001b[0m slangLib, metadata \u001b[38;5;241m=\u001b[39m \u001b[43mcompileAndLoadModule\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m    536\u001b[0m \u001b[43m    \u001b[49m\u001b[43mmetadata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43mcppOutName\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcudaOutName\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m    537\u001b[0m \u001b[43m    \u001b[49m\u001b[43mmoduleName\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moutputFolder\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mslangSourceDir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    538\u001b[0m \u001b[43m    \u001b[49m\u001b[43mverbose\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdryRun\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdryRun\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    540\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m dryRun:\n\u001b[1;32m    541\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m slangLib:\n\nFile \u001b[0;32m~/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/slangpy/slangpy.py:426\u001b[0m, in \u001b[0;36mcompileAndLoadModule\u001b[0;34m(metadata, sources, moduleName, buildDir, slangSourceDir, verbose, dryRun)\u001b[0m\n\u001b[1;32m    423\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m, \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m    425\u001b[0m \u001b[38;5;66;03m# Compile the module.\u001b[39;00m\n\u001b[0;32m--> 426\u001b[0m slangLib \u001b[38;5;241m=\u001b[39m \u001b[43m_compileAndLoadModule\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmetadata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msources\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmoduleName\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuildDir\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mslangSourceDir\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mverbose\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    428\u001b[0m newMetadata \u001b[38;5;241m=\u001b[39m metadata\u001b[38;5;241m.\u001b[39mcopy()\n\u001b[1;32m    429\u001b[0m newMetadata[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmoduleName\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m moduleName\n\nFile \u001b[0;32m~/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/slangpy/slangpy.py:465\u001b[0m, in \u001b[0;36m_compileAndLoadModule\u001b[0;34m(metadata, sources, moduleName, buildDir, slangSourceDir, verbose)\u001b[0m\n\u001b[1;32m    462\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m    463\u001b[0m     extra_include_paths \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m--> 465\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mjit_compile\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m    466\u001b[0m \u001b[43m    \u001b[49m\u001b[43mmoduleName\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    467\u001b[0m \u001b[43m    \u001b[49m\u001b[43msources\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    468\u001b[0m \u001b[43m    \u001b[49m\u001b[43mextra_cflags\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextra_cflags\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    469\u001b[0m \u001b[43m    \u001b[49m\u001b[43mextra_cuda_cflags\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextra_cuda_cflags\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    470\u001b[0m \u001b[43m    \u001b[49m\u001b[43mextra_ldflags\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m    471\u001b[0m \u001b[43m    \u001b[49m\u001b[43mextra_include_paths\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextra_include_paths\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    472\u001b[0m \u001b[43m    \u001b[49m\u001b[43mbuild_directory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mos\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrealpath\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbuildDir\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    473\u001b[0m \u001b[43m    \u001b[49m\u001b[43mverbose\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mverbose\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    474\u001b[0m \u001b[43m    \u001b[49m\u001b[43mis_python_module\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m    475\u001b[0m \u001b[43m    \u001b[49m\u001b[43mis_standalone\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m    476\u001b[0m \u001b[43m    \u001b[49m\u001b[43mkeep_intermediates\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m    477\u001b[0m \u001b[43m    \u001b[49m\u001b[43mwith_cuda\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\n\nFile \u001b[0;32m~/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/slangpy/util/compile.py:71\u001b[0m, in \u001b[0;36mjit_compile\u001b[0;34m(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_python_module, is_standalone, keep_intermediates)\u001b[0m\n\u001b[1;32m     67\u001b[0m                 hipified_sources\u001b[38;5;241m.\u001b[39madd(hipify_result[s_abs][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhipified_path\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m s_abs \u001b[38;5;129;01min\u001b[39;00m hipify_result \u001b[38;5;28;01melse\u001b[39;00m s_abs)\n\u001b[1;32m     69\u001b[0m             sources \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlist\u001b[39m(hipified_sources)\n\u001b[0;32m---> 71\u001b[0m         \u001b[43m_write_ninja_file_and_build_library\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m     72\u001b[0m \u001b[43m            \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     73\u001b[0m \u001b[43m            \u001b[49m\u001b[43msources\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msources\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     74\u001b[0m \u001b[43m            \u001b[49m\u001b[43mextra_cflags\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextra_cflags\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     75\u001b[0m \u001b[43m            \u001b[49m\u001b[43mextra_cuda_cflags\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextra_cuda_cflags\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     76\u001b[0m \u001b[43m            \u001b[49m\u001b[43mextra_ldflags\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextra_ldflags\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     77\u001b[0m \u001b[43m            \u001b[49m\u001b[43mextra_include_paths\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextra_include_paths\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     78\u001b[0m \u001b[43m            \u001b[49m\u001b[43mbuild_directory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbuild_directory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     79\u001b[0m \u001b[43m            \u001b[49m\u001b[43mverbose\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mverbose\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     80\u001b[0m \u001b[43m            \u001b[49m\u001b[43mwith_cuda\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mwith_cuda\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     81\u001b[0m \u001b[43m            \u001b[49m\u001b[43mis_standalone\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mis_standalone\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m     82\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[1;32m     83\u001b[0m     baton\u001b[38;5;241m.\u001b[39mrelease()\n\nFile \u001b[0;32m~/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/utils/cpp_extension.py:1623\u001b[0m, in \u001b[0;36m_write_ninja_file_and_build_library\u001b[0;34m(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_standalone)\u001b[0m\n\u001b[1;32m   1621\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m verbose:\n\u001b[1;32m   1622\u001b[0m     \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mBuilding extension module \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mname\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m...\u001b[39m\u001b[38;5;124m'\u001b[39m, file\u001b[38;5;241m=\u001b[39msys\u001b[38;5;241m.\u001b[39mstderr)\n\u001b[0;32m-> 1623\u001b[0m \u001b[43m_run_ninja_build\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m   1624\u001b[0m \u001b[43m    \u001b[49m\u001b[43mbuild_directory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1625\u001b[0m \u001b[43m    \u001b[49m\u001b[43mverbose\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1626\u001b[0m \u001b[43m    \u001b[49m\u001b[43merror_prefix\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43mf\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mError building extension \u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;132;43;01m{\u001b[39;49;00m\u001b[43mname\u001b[49m\u001b[38;5;132;43;01m}\u001b[39;49;00m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\nFile \u001b[0;32m~/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/utils/cpp_extension.py:1916\u001b[0m, in \u001b[0;36m_run_ninja_build\u001b[0;34m(build_directory, verbose, error_prefix)\u001b[0m\n\u001b[1;32m   1914\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(error, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124moutput\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m error\u001b[38;5;241m.\u001b[39moutput:  \u001b[38;5;66;03m# type: ignore[union-attr]\u001b[39;00m\n\u001b[1;32m   1915\u001b[0m     message \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00merror\u001b[38;5;241m.\u001b[39moutput\u001b[38;5;241m.\u001b[39mdecode(\u001b[38;5;241m*\u001b[39mSUBPROCESS_DECODE_ARGS)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m  \u001b[38;5;66;03m# type: ignore[union-attr]\u001b[39;00m\n\u001b[0;32m-> 1916\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(message) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n\n\u001b[0;31mRuntimeError\u001b[0m: Error building extension '_slangpy_bezier_compute_44136fa355b3678a': [1/3] /usr/local/cuda-11.7/bin/nvcc  -DTORCH_EXTENSION_NAME=_slangpy_bezier_compute_44136fa355b3678a -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\\\"_gcc\\\" -DPYBIND11_STDLIB=\\\"_libstdcpp\\\" -DPYBIND11_BUILD_ABI=\\\"_cxxabi1011\\\" -I/home/ubuntu/slang-python/examples/bezier2d -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda-11.7/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++17 -c /home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu -o bezier_compute_cuda.cuda.o \nFAILED: bezier_compute_cuda.cuda.o \n/usr/local/cuda-11.7/bin/nvcc  -DTORCH_EXTENSION_NAME=_slangpy_bezier_compute_44136fa355b3678a -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\\\"_gcc\\\" -DPYBIND11_STDLIB=\\\"_libstdcpp\\\" -DPYBIND11_BUILD_ABI=\\\"_cxxabi1011\\\" -I/home/ubuntu/slang-python/examples/bezier2d -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda-11.7/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++17 -c /home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu -o bezier_compute_cuda.cuda.o \n/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu(2372): warning #550-D: variable \"oldVal_0\" was set but never used\n\n/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu(2379): warning #550-D: variable \"oldVal_1\" was set but never used\n\n/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu(3036): error: identifier \"determinant\" is undefined\n\n/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu(3517): error: identifier \"determinant\" is undefined\n\n2 errors detected in the compilation of \"/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute_cuda.cu\".\n[2/3] c++ -MMD -MF bezier_compute.o.d -DTORCH_EXTENSION_NAME=_slangpy_bezier_compute_44136fa355b3678a -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\\\"_gcc\\\" -DPYBIND11_STDLIB=\\\"_libstdcpp\\\" -DPYBIND11_BUILD_ABI=\\\"_cxxabi1011\\\" -I/home/ubuntu/slang-python/examples/bezier2d -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda-11.7/include -isystem /home/ubuntu/anaconda3/envs/gaussian_splatting/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -std=c++17 -c /home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute.cpp -o bezier_compute.o \n/home/ubuntu/slang-python/examples/bezier2d/.slangpy_cache/bezier_compute/44136fa355b3678a/bezier_compute.cpp:8398:9: warning: #pragma once in main file\n 8398 | #pragma once\n      |         ^~~~\nninja: build stopped: subcommand failed.\n"
}
chinmay0301ucsd commented 8 months ago

Resolved: The correction function to use is __determinant_impl, that atleast allows compilation.