Skip to content

Commit 09625ea

Browse files
committed
Format the changes
1 parent 1426715 commit 09625ea

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/core/utils/JitHelper.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ jitify::Program JitHelper::buildProgram(
103103
memset(&prop, 0, sizeof(prop));
104104
if (cudaGetDevice(&dev) == cudaSuccess && cudaGetDeviceProperties(&prop, dev) == cudaSuccess &&
105105
prop.major > 0 && prop.minor >= 0) {
106-
std::string detected_arch =
107-
"compute_" + std::to_string(prop.major) + std::to_string(prop.minor);
106+
std::string detected_arch = "compute_" + std::to_string(prop.major) + std::to_string(prop.minor);
108107
std::vector<std::string> arch_flags = flags;
109108
arch_flags.push_back("-arch=" + detected_arch);
110109
return kcache->program(code, header_code, arch_flags);
@@ -119,9 +118,9 @@ jitify::Program JitHelper::buildProgram(
119118
} catch (const std::exception& e) {
120119
const std::string err_msg = e.what();
121120
// Only fall through to Stage 3 when the failure is architecture-related.
122-
const bool is_arch_error = (err_msg.find("arch") != std::string::npos ||
123-
err_msg.find("compute_") != std::string::npos ||
124-
err_msg.find("sm_") != std::string::npos);
121+
const bool is_arch_error =
122+
(err_msg.find("arch") != std::string::npos || err_msg.find("compute_") != std::string::npos ||
123+
err_msg.find("sm_") != std::string::npos);
125124
if (!is_arch_error) {
126125
throw;
127126
}
@@ -130,19 +129,17 @@ jitify::Program JitHelper::buildProgram(
130129
// Use the DEME_DEFAULT_CUDA_ARCH environment variable if set; otherwise fall
131130
// back to the compile-time constant DEME_DEFAULT_CUDA_ARCH_STR.
132131
const char* env_arch = std::getenv("DEME_DEFAULT_CUDA_ARCH");
133-
const std::string fallback_arch = (env_arch != nullptr && env_arch[0] != '\0')
134-
? std::string(env_arch)
135-
: DEME_DEFAULT_CUDA_ARCH_STR;
132+
const std::string fallback_arch =
133+
(env_arch != nullptr && env_arch[0] != '\0') ? std::string(env_arch) : DEME_DEFAULT_CUDA_ARCH_STR;
136134
std::vector<std::string> fallback_flags = flags;
137135
fallback_flags.push_back("-arch=" + fallback_arch);
138136
try {
139137
return kcache->program(code, header_code, fallback_flags);
140138
} catch (const std::exception& e3) {
141139
std::string ctx = "Jitify compilation failed with fallback arch '";
142140
ctx += fallback_arch;
143-
ctx += (env_arch != nullptr && env_arch[0] != '\0')
144-
? "' (from DEME_DEFAULT_CUDA_ARCH env var): "
145-
: "' (compile-time default): ";
141+
ctx += (env_arch != nullptr && env_arch[0] != '\0') ? "' (from DEME_DEFAULT_CUDA_ARCH env var): "
142+
: "' (compile-time default): ";
146143
ctx += e3.what();
147144
throw std::runtime_error(ctx);
148145
}

0 commit comments

Comments
 (0)