woct0rdho / triton-windows

Fork of the Triton language and compiler for Windows support
MIT License
178 stars 9 forks source link

Triton 3.10 windows error: The system cannot find the file specified #9

Closed roman8ivanov closed 2 weeks ago

roman8ivanov commented 1 month ago

I am getting error when run the test (see below). Traceback (most recent call last):

Cell In[4], line 1 b_compiled = add(a, a)

Cell In[2], line 17 in add add_kernel[grid](x, y, output, n_elements, BLOCK_SIZE=1024)

File C:\ProgramData\anaconda3\Lib\site-packages\triton\runtime\jit.py:345 in return lambda *args, *kwargs: self.run(grid=grid, warmup=False, args, **kwargs)

File C:\ProgramData\anaconda3\Lib\site-packages\triton\runtime\jit.py:607 in run device = driver.active.get_current_device()

File C:\ProgramData\anaconda3\Lib\site-packages\triton\runtime\driver.py:23 in getattr self._initialize_obj()

File C:\ProgramData\anaconda3\Lib\site-packages\triton\runtime\driver.py:20 in _initialize_obj self._obj = self._init_fn()

File C:\ProgramData\anaconda3\Lib\site-packages\triton\runtime\driver.py:9 in _create_driver return actives[0]()

File C:\ProgramData\anaconda3\Lib\site-packages\triton\backends\nvidia\driver.py:414 in init self.utils = CudaUtils() # TODO: make static

File C:\ProgramData\anaconda3\Lib\site-packages\triton\backends\nvidia\driver.py:92 in init mod = compile_module_from_src(Path(os.path.join(dirname, "driver.c")).read_text(), "cuda_utils")

File C:\ProgramData\anaconda3\Lib\site-packages\triton\backends\nvidia\driver.py:69 in compile_module_from_src so = _build(name, src_path, tmpdir, library_dirs(), include_dir, libraries)

File C:\ProgramData\anaconda3\Lib\site-packages\triton\runtime\build.py:71 in _build ret = subprocess.check_call(cc_cmd)

File C:\ProgramData\anaconda3\Lib\subprocess.py:408 in check_call retcode = call(*popenargs, **kwargs)

File C:\ProgramData\anaconda3\Lib\subprocess.py:389 in call with Popen(*popenargs, **kwargs) as p:

File C:\ProgramData\anaconda3\Lib\site-packages\spyder_kernels\customize\spydercustomize.py:109 in init super(SubprocessPopen, self).init(*args, **kwargs)

File C:\ProgramData\anaconda3\Lib\subprocess.py:1026 in init self._execute_child(args, executable, preexec_fn, close_fds,

File C:\ProgramData\anaconda3\Lib\subprocess.py:1538 in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

FileNotFoundError: [WinError 2] The system cannot find the file specified

woct0rdho commented 4 weeks ago

Can you print out the content of cc_cmd before running ret = subprocess.check_call(cc_cmd)?

roman8ivanov commented 3 weeks ago

image

woct0rdho commented 3 weeks ago

Do you actually have this cl.exe in its folder? What happens if you open a new PowerShell and type cl?

roman8ivanov commented 3 weeks ago

image

woct0rdho commented 3 weeks ago

What is the path of that cl.exe? You can type Get-Command cl to show its path

(Things can get weird if one installs multiple versions of MSVC)

roman8ivanov commented 3 weeks ago

image

woct0rdho commented 3 weeks ago

So it seems you have installed multiple versions of MSVC. The one in your PATH is not the one found by Triton and shown in cc_cmd

(My code first try to find MSVC using vswhere, then using PATH. You can see the details in windows_utils.py in this repo)

Maybe you can uninstall all other versions of MSVC and only have one left, then try again

roman8ivanov commented 3 weeks ago

It is strange as I don't have this folder: 'c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64\cl.exe'

woct0rdho commented 3 weeks ago

Before I thought that vswhere should be more reliable than PATH but now I'm not so sure... Maybe you can edit triton/windows_utils.py, remove the find_msvc_base_vswhere() part in the function find_msvc(), then try again

roman8ivanov commented 3 weeks ago

I keep getting the same error after removing find_msvc_base_vswhere() part in the function find_msvc(). image

roman8ivanov commented 3 weeks ago

I fixed issue. I had by chance another system variable with wrong cl.exe path.