batch_invariant.hpp 432 Bytes
Newer Older
1
2
3
4
5
6
7
#pragma once
#include <cstdlib>
#include <string>
#include <cctype>

namespace vllm {

8
9
10
// vllm_is_batch_invariant(); returns true
// if env VLLM_BATCH_INVARIANT=1
inline bool vllm_is_batch_invariant() {
11
  static bool cached = []() {
12
    std::string env_key = "VLLM_BATCH_INVARIANT";
13
14
15
16
    const char* val = std::getenv(env_key.c_str());
    return (val && std::atoi(val) != 0) ? 1 : 0;
  }();
  return cached;
17
18
19
}

}  // namespace vllm