@@ -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