2025-09-26 19:59:09 -04:00
|
|
|
#pragma once
|
|
|
|
|
#include <cstdlib>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <cctype>
|
|
|
|
|
|
|
|
|
|
namespace vllm {
|
|
|
|
|
|
2025-10-16 14:40:25 -07:00
|
|
|
// vllm_is_batch_invariant(); returns true
|
|
|
|
|
// if env VLLM_BATCH_INVARIANT=1
|
|
|
|
|
inline bool vllm_is_batch_invariant() {
|
2025-10-10 15:47:34 -07:00
|
|
|
static bool cached = []() {
|
2025-10-16 14:40:25 -07:00
|
|
|
std::string env_key = "VLLM_BATCH_INVARIANT";
|
2025-10-10 15:47:34 -07:00
|
|
|
const char* val = std::getenv(env_key.c_str());
|
|
|
|
|
return (val && std::atoi(val) != 0) ? 1 : 0;
|
|
|
|
|
}();
|
|
|
|
|
return cached;
|
2025-09-26 19:59:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace vllm
|