Skip to content

Commit a1d7502

Browse files
authored
windows flag added (#11)
* windows flag added * windows flag added
1 parent d73fb52 commit a1d7502

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

flashrnn/flashrnn/cuda_init.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,17 @@ def load(*, name, sources, extra_cflags=(), extra_cuda_cflags=(), **kwargs):
132132
extra_cflags.append(f"-I{conda_prefix_include}")
133133
extra_cuda_cflags = list(extra_cuda_cflags) + [f"-I{conda_prefix_include}"]
134134

135+
# Windows: MSVC link.exe needs /LIBPATH: and *.lib, not the Unix -L / -l form.
136+
if IS_WINDOWS:
137+
_win_cuda_libdir = os.path.join(CUDA_HOME, "lib", "x64")
138+
_extra_ldflags = [f"/LIBPATH:{_win_cuda_libdir}", "cublas.lib"]
139+
else:
140+
_extra_ldflags = [f"-L{os.environ['CUDA_LIB']}", "-lcublas"]
141+
135142
myargs = {
136143
"verbose": True,
137144
"with_cuda": True,
138-
"extra_ldflags": [f"-L{os.environ['CUDA_LIB']}", "-lcublas"],
145+
"extra_ldflags": _extra_ldflags,
139146
"extra_cflags": [*extra_cflags],
140147
"extra_cuda_cflags": [
141148
# "-gencode",
@@ -147,7 +154,9 @@ def load(*, name, sources, extra_cflags=(), extra_cuda_cflags=(), **kwargs):
147154
"-res-usage",
148155
"--use_fast_math",
149156
"-O3",
150-
"-Xptxas -O3",
157+
# Windows nvcc rejects the joined token "-Xptxas -O3"; pass as two args.
158+
"-Xptxas",
159+
"-O3",
151160
"--extra-device-vectorization",
152161
*extra_cflags,
153162
*extra_cuda_cflags,

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies = [
1717
"torch",
1818
"einops",
1919
"triton; sys_platform == 'linux'",
20+
"triton-windows; sys_platform == 'win32'",
2021
"ninja"
2122
]
2223

0 commit comments

Comments
 (0)