Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fengzch-das
nunchaku
Commits
67723598
Unverified
Commit
67723598
authored
Mar 07, 2025
by
Zhekai Zhang
Committed by
GitHub
Mar 07, 2025
Browse files
Merge pull request #157 from mit-han-lab/dev
Fix missing third_party & merge main branch of dev repo
parents
e1c5f3e4
75dad570
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
46 additions
and
1 deletion
+46
-1
setup.py
setup.py
+1
-1
src/Module.h
src/Module.h
+40
-0
third_party/Block-Sparse-Attention
third_party/Block-Sparse-Attention
+1
-0
third_party/Block-Sparse-Attention/.gitkeep
third_party/Block-Sparse-Attention/.gitkeep
+0
-0
third_party/cutlass
third_party/cutlass
+1
-0
third_party/cutlass/.gitkeep
third_party/cutlass/.gitkeep
+0
-0
third_party/json
third_party/json
+1
-0
third_party/json/.gitkeep
third_party/json/.gitkeep
+0
-0
third_party/mio
third_party/mio
+1
-0
third_party/mio/.gitkeep
third_party/mio/.gitkeep
+0
-0
third_party/spdlog
third_party/spdlog
+1
-0
third_party/spdlog/.gitkeep
third_party/spdlog/.gitkeep
+0
-0
No files found.
setup.py
View file @
67723598
...
...
@@ -129,7 +129,7 @@ if __name__ == "__main__":
for
target
in
sm_targets
:
NVCC_FLAGS
+=
[
"-gencode"
,
f
"arch=compute_
{
target
}
,code=sm_
{
target
}
"
]
NVCC_MSVC_FLAGS
=
[
"-Xcompiler"
,
"/Zc:__cplusplus"
,
"-Xcompiler"
,
"/FS"
]
NVCC_MSVC_FLAGS
=
[
"-Xcompiler"
,
"/Zc:__cplusplus"
,
"-Xcompiler"
,
"/FS"
,
"-Xcompiler"
,
"/bigobj"
]
nunchaku_extension
=
CUDAExtension
(
name
=
"nunchaku._C"
,
...
...
src/Module.h
View file @
67723598
...
...
@@ -215,6 +215,11 @@ struct LayerOffloadHelper {
if
(
offload
)
{
streamCompute
=
std
::
make_unique
<
CUDAStreamWrapper
>
();
streamLoad
=
std
::
make_unique
<
CUDAStreamWrapper
>
();
needWorkaround
=
checkWorkaround
();
if
(
needWorkaround
)
{
spdlog
::
debug
(
"Offloading helper: use WDDM workaround"
);
}
}
}
...
...
@@ -240,6 +245,7 @@ private:
funcCompute
(
layer
);
nextComputeDone
=
std
::
make_unique
<
CUDAEventWrapper
>
();
checkCUDA
(
cudaEventRecord
(
nextComputeDone
->
event
,
getCurrentCUDAStream
()));
workaroundFlush
();
}
{
...
...
@@ -253,10 +259,13 @@ private:
}
nextLoadDone
=
std
::
make_unique
<
CUDAEventWrapper
>
();
checkCUDA
(
cudaEventRecord
(
nextLoadDone
->
event
,
getCurrentCUDAStream
()));
workaroundFlush
();
}
eventComputeDone
=
std
::
move
(
nextComputeDone
);
eventLoadDone
=
std
::
move
(
nextLoadDone
);
workaroundSynchronize
();
}
}
...
...
@@ -266,4 +275,35 @@ private:
}
checkCUDA
(
cudaStreamWaitEvent
(
getCurrentCUDAStream
(),
event
->
event
));
}
// WDDM prevents multiple streams run concurrently
// use flush and synchronize to work around
bool
needWorkaround
;
static
bool
checkWorkaround
()
{
if
(
char
*
env
=
getenv
(
"NUNCHAKU_OFFLOAD_WDDM_WORKAROUND"
))
{
if
(
std
::
string
(
env
)
==
"1"
)
{
return
true
;
}
else
if
(
std
::
string
(
env
)
==
"0"
)
{
return
false
;
}
}
#ifdef _WIN32
return
true
;
#else
return
false
;
#endif
}
void
workaroundFlush
()
{
if
(
!
needWorkaround
)
{
return
;
}
cudaStreamQuery
(
getCurrentCUDAStream
());
}
void
workaroundSynchronize
()
{
if
(
!
needWorkaround
)
{
return
;
}
checkCUDA
(
cudaEventSynchronize
(
eventComputeDone
->
event
));
}
};
\ No newline at end of file
Block-Sparse-Attention
@
0d23f715
Subproject commit 0d23f715690c5171fd93679de8afd149376db167
third_party/Block-Sparse-Attention/.gitkeep
deleted
100644 → 0
View file @
e1c5f3e4
cutlass
@
a75b4ac4
Subproject commit a75b4ac483166189a45290783cb0a18af5ff0ea5
third_party/cutlass/.gitkeep
deleted
100644 → 0
View file @
e1c5f3e4
json
@
63258397
Subproject commit 63258397761b3dd96dd171e5a5ad5aa915834c35
third_party/json/.gitkeep
deleted
100644 → 0
View file @
e1c5f3e4
mio
@
8b6b7d87
Subproject commit 8b6b7d878c89e81614d05edca7936de41ccdd2da
third_party/mio/.gitkeep
deleted
100644 → 0
View file @
e1c5f3e4
spdlog
@
27cb4c76
Subproject commit 27cb4c76708608465c413f6d0e6b8d99a4d84302
third_party/spdlog/.gitkeep
deleted
100644 → 0
View file @
e1c5f3e4
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment