豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 3a93f4e

Browse files
authored
Fix B200 cu128 NVCC compilation failed (#173)
1 parent 9c3783b commit 3a93f4e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

csrc/jit/compiler.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,14 @@ class NVCCCompiler final: public Compiler {
155155
signature = fmt::format("NVCC{}.{}", nvcc_major, nvcc_minor);
156156

157157
// The override the compiler flags
158+
std::string selected_arch = device_runtime->get_arch();
159+
// Compatibility: NVCC < 12.9 may not recognize sm_100f; fallback to sm_100a
160+
if (selected_arch == "100f" && (nvcc_major < 12 || (nvcc_major == 12 && nvcc_minor < 9)))
161+
selected_arch = "100a";
158162
flags = fmt::format("{} -I{} --gpu-architecture=sm_{} "
159163
"--compiler-options=-fPIC,-O3,-fconcepts,-Wno-deprecated-declarations,-Wno-abi "
160164
"-cubin -O3 --expt-relaxed-constexpr --expt-extended-lambda",
161-
flags, library_include_path.c_str(), device_runtime->get_arch());
165+
flags, library_include_path.c_str(), selected_arch);
162166
}
163167

164168
void compile(const std::string &code, const std::filesystem::path& dir_path, const std::filesystem::path &cubin_path) const override {
@@ -205,8 +209,12 @@ class NVRTCCompiler final: public Compiler {
205209
}
206210

207211
// Override the compiler flags
212+
std::string selected_arch = device_runtime->get_arch();
213+
// Compatibility: NVRTC < 12.9 may not recognize sm_100f; fallback to sm_100a
214+
if (selected_arch == "100f" && (major < 12 || (major == 12 && minor < 9)))
215+
selected_arch = "100a";
208216
flags = fmt::format("{} {}--gpu-architecture=sm_{} -default-device {}",
209-
flags, include_dirs, device_runtime->get_arch(), pch_flags);
217+
flags, include_dirs, selected_arch, pch_flags);
210218
}
211219

212220
void compile(const std::string &code, const std::filesystem::path& dir_path, const std::filesystem::path &cubin_path) const override {

0 commit comments

Comments
 (0)