18#include <batchlas/export.hh>
56 e.value_ = std::move(v);
61 bool is_set() const noexcept {
return set_; }
64 const char*
get() const noexcept {
return set_ ? value_.c_str() :
nullptr; }
67 const std::string&
value() const noexcept {
return value_; }
84 static constexpr std::array<std::string_view, 19>
ops{
85 "gemm",
"gemv",
"trsm",
"trmm",
"symm",
"syrk",
"syr2k",
"potrf",
"posv",
"getrf",
86 "getrs",
"getri",
"gesv",
"geqrf",
"orgqr",
"ormqr",
"syev",
"gesvd",
"spmm"};
92 static constexpr std::size_t
index_of(std::string_view op) {
93 for (std::size_t i = 0; i <
ops.size(); ++i)
94 if (
ops[i] == op)
return i;
105 static std::size_t checked(std::string_view op) {
108 throw std::invalid_argument(
"batchlas: no BATCHLAS_<OP>_ROUTE for op '" + std::string(op) +
"'");
429 std::string
dir =
"output/bandr1_dumps";
A raw captured environment value, shaped like the std::getenv call it replaces.
const char * get() const noexcept
The value, or nullptr when unset: the drop-in for std::getenv("...").
static EnvValue unset()
An unset value.
EnvValue(const char *raw)
Construct from what std::getenv returned.
bool is_set() const noexcept
True when the variable was set, including set to the empty string.
EnvValue()=default
An unset value.
const std::string & value() const noexcept
The value as text; empty when unset.
static EnvValue of(std::string v)
A value that is set to v (which may be empty).
bool queue_constructed() noexcept
True once note_queue_constructed() has been called.
void note_queue_constructed() noexcept
Latch recording that a Queue exists, which closes configure().
void configure(const Settings &s)
Install s as the settings, for an embedding application that wants to stop inheriting ambient process...
const Settings & settings()
The process-wide settings.
void reload_settings()
Re-read the environment on top of the last configure() (or the defaults).
The BATCHLAS_DUMP_BANDR1_* band-reduction dump family.
int sweep_index
BATCHLAS_DUMP_BANDR1_SWEEP_INDEX
std::string dir
BATCHLAS_DUMP_BANDR1_DIR: created with create_directories(); files are written under it while step is...
int batch
BATCHLAS_DUMP_BANDR1_BATCH; -1 dumps every item
bool abw_only
BATCHLAS_DUMP_BANDR1_ABW_ONLY (env_truthy): suppress every dump except ABw.
int step_index
BATCHLAS_DUMP_BANDR1_STEP_INDEX
int step_in_sweep
BATCHLAS_DUMP_BANDR1_STEP_IN_SWEEP
bool step
BATCHLAS_DUMP_BANDR1_STEP (env_truthy): the master enable.
Tracing, dumping, profiling and the opt-in checks.
bool debug_filter_degree
BATCHLAS_DEBUG_FILTER_DEGREE: presence only, so any value including the empty string enables it.
bool profiling
BATCHLAS_QUEUE_PROFILING or BATCHLAS_BENCH_PROFILING (env_truthy, ORed): enable SYCL queue profiling.
bool syevx_trace
BATCHLAS_SYEVX_TRACE (env_truthy).
bool cta_debug_sync
BATCHLAS_CTA_DEBUG_SYNC (env_truthy): prints [cta-debug] <stage> and drains the pipeline at each stag...
bool metal_flush_each_op
BATCHLAS_METAL_FLUSH_EACH_OP (env_truthy): Metal queues created afterwards commit one command buffer ...
bool gesvd_profile
BATCHLAS_GESVD_PROFILE (env_truthy): forces a wait_and_throw() per stage, serialising the pipeline,...
EnvValue coverage_out
BATCHLAS_COVERAGE_OUT: dispatch coverage is written to <value>.<pid> at exit.
bool select_trace
BATCHLAS_SELECT_TRACE (env_truthy): one stderr line per select::choose decision (src/select/select....
bool debug_sytrd_small
BATCHLAS_DEBUG_SYTRD_SMALL (env_truthy). Prints once.
struct batchlas::DiagnosticsSettings::DumpBandR1Settings dump_bandr1
The band-reduction dump family.
bool kernel_trace
BATCHLAS_KERNEL_TRACE or BATCHLAS_TRACE_KERNELS (env_truthy, ORed).
EnvValue steqr_cta_check
BATCHLAS_STEQR_CTA_CHECK (first character {1,t,T,y,Y}): steqr_cta scans its per-item status and throw...
std::string kernel_trace_path
The first non-empty of BATCHLAS_KERNEL_TRACE_PATH and BATCHLAS_TRACE_PATH.
The runtime overrides of include/batchlas/tuning_params.hh (BATCHLAS_TUNE_*).
EnvValue stedc_merge_variant
BATCHLAS_TUNE_STEDC_MERGE_VARIANT: a StedcMergeVariant value; 0 (Auto) is unreachable.
EnvValue stedc_wg_multiplier
BATCHLAS_TUNE_STEDC_WG_MULTIPLIER
EnvValue stedc_recursion_threshold
BATCHLAS_TUNE_STEDC_RECURSION_THRESHOLD
EnvValue gebrd_block_size
BATCHLAS_TUNE_GEBRD_BLOCK_SIZE
EnvValue sb2st_back_tile
BATCHLAS_TUNE_SB2ST_BACK_TILE
EnvValue sytrd_block_size
BATCHLAS_TUNE_SYTRD_BLOCK_SIZE
EnvValue sb2st_back_subs
BATCHLAS_TUNE_SB2ST_BACK_SUBS
EnvValue stedc_threads_per_root
BATCHLAS_TUNE_STEDC_THREADS_PER_ROOT
EnvValue latrd_wg_hint
BATCHLAS_TUNE_LATRD_WG_HINT
EnvValue ormqr_block_size
BATCHLAS_TUNE_ORMQR_BLOCK_SIZE
EnvValue sy2sb_ormqr_nb
BATCHLAS_TUNE_SY2SB_ORMQR_NB
Launch geometry, block widths, iteration counts and tuning thresholds.
int latrd_lower_panel_wg_hint
BATCHLAS_LATRD_LOWER_PANEL_WG_HINT.
int syevx_check_every
BATCHLAS_SYEVX_CHECK_EVERY: iterations between convergence checks; each check is a full pipeline drai...
int potrf_nb
BATCHLAS_POTRF_NB.
EnvValue sb2st_back_tile
BATCHLAS_SB2ST_BACK_TILE: tile of the tiled back-transform kernel (a different kernel from sb2st_back...
double syevx_lock_factor
BATCHLAS_SYEVX_LOCK_FACTOR (atof, > 0 only): a column is masked once its residual is this multiple of...
int potrf_w
BATCHLAS_POTRF_W. 0 = unset; the default is type-dependent (128/32/32/16).
int syev_two_stage_sb2st_block
BATCHLAS_SYEV_TWO_STAGE_SB2ST_BLOCK (env_positive_int_or).
int syevx_filter_degree
BATCHLAS_SYEVX_FILTER_DEGREE.
EnvValue sy2sb_ormqr_nb
BATCHLAS_SY2SB_ORMQR_NB: unset, off or 0 (never hint), or a positive forced value (clamped to kd at t...
int latrd_grid_wg
BATCHLAS_LATRD_GRID_WG (env_positive_int_or).
int latrd_grid_groups
BATCHLAS_LATRD_GRID_GROUPS (env_positive_int_or).
int syev_two_stage_kd
BATCHLAS_SYEV_TWO_STAGE_KD (env_positive_int_or): the band width, clamped to [1, n-1] at the call sit...
int trsm_outer_nb
BATCHLAS_TRSM_OUTER_NB. 0 = unset: 128 for Side::Left, the CTA nb for Side::Right.
int sb2st_back_tile_w
BATCHLAS_SB2ST_BACK_TILE_W (env_positive_int_or): column tile of the wave kernel.
std::optional< int > syevx_init_power
BATCHLAS_SYEVX_INIT_POWER: 0 means "no power iterations"; nullopt means 4 unless SyevxParams supplied...
int latrd_grid_min_n
BATCHLAS_LATRD_GRID_MIN_N (env_positive_int_or): the n at which the grid latrd path becomes eligible.
EnvValue expand_max_bytes
BATCHLAS_EXPAND_MAX_BYTES (strtoull): only ever lowers the expansion ceiling, whose default is GLOBAL...
int trmm_tile_m
BATCHLAS_TRMM_TILE_M. 0 = unset (a function of m); bucketed to 16, 32, 64 or 128.
struct batchlas::GeometrySettings::TuneSettings tune
The eleven BATCHLAS_TUNE_* overrides.
EnvValue gesvd_blocked_gebrd_min
BATCHLAS_GESVD_BLOCKED_GEBRD_MIN (bare atoi, default 1).
int sb2st_back_subs
BATCHLAS_SB2ST_BACK_SUBS (env_positive_int_or).
std::optional< int > syevx_extra_directions
BATCHLAS_SYEVX_EXTRA_DIRECTIONS: 0 means "no guard block"; nullopt means the default max(2,...
int sytrd_block_size
BATCHLAS_SYTRD_BLOCK_SIZE.
The route pins: BATCHLAS_<OP>_ROUTE, one raw string per op that selects a kernel.
std::array< EnvValue, ops.size()> values
BATCHLAS_<OP>_ROUTE, in ops order.
EnvValue & route(std::string_view op)
Mutable access to the captured BATCHLAS_<OP>_ROUTE for op, as configure() needs.
const EnvValue & route(std::string_view op) const
The captured BATCHLAS_<OP>_ROUTE for op.
static constexpr std::array< std::string_view, 19 > ops
The ops that read a route variable, by their <op> spelling.
static constexpr std::size_t index_of(std::string_view op)
Position of op in ops, or ops.size() when op reads no route variable.
Which kernel or algorithm runs, for the knobs outside the route pins.
EnvValue tuned_dir
BATCHLAS_TUNED_DIR: a directory of select tables (src/select/select.hh); a file there replaces the bu...
EnvValue getrf_leaf
BATCHLAS_GETRF_LEAF = slm | reg (default: the register-resident panel leaf wherever the panel fits).
EnvValue gemv_segt
BATCHLAS_GEMV_SEGT = off | auto | 2 | 4 | 8: segmented-tail width of the native gemv.
EnvValue syevx_soft_lock
BATCHLAS_SYEVX_SOFT_LOCK.
EnvValue syevx_projected_vendor
BATCHLAS_SYEVX_PROJECTED_VENDOR: same first-character dialect.
EnvValue ormqr_wy
BATCHLAS_ORMQR_WY = gemm | trmm | measured: overrides the measured gate.
std::optional< bool > sytrd_fuse_panel_update
BATCHLAS_SYTRD_FUSE_PANEL_UPDATE: forced on (env_truthy), forced off (env_falsy), or std::nullopt to ...
EnvValue sytrd_impl
BATCHLAS_SYTRD_IMPL: only the exact value device has an effect.
EnvValue sytrd_trailing_update
BATCHLAS_SYTRD_TRAILING_UPDATE = gemm | syr2k | her2k | rank2k, either case; syr2k and her2k select o...
EnvValue sb2st_back_wave
BATCHLAS_SB2ST_BACK_WAVE: the wave-parallel back-transform is on unless disabled with one of 0,...
EnvValue syev_two_stage_chase
BATCHLAS_SYEV_TWO_STAGE_CHASE: only the exact value givens has an effect.
bool sytrd_force_local_small
BATCHLAS_SYTRD_FORCE_LOCAL_SMALL (env_truthy): forces the local-memory small-n path past the tuning h...
EnvValue ormqr_impl
BATCHLAS_ORMQR_IMPL: only the exact value device has an effect.
EnvValue getrs_laswp
BATCHLAS_GETRS_LASWP = walk | gather. Deliberately not latched (as gemv_segt).
EnvValue syevx_algorithm
BATCHLAS_SYEVX_ALGORITHM: overrides an explicit SyevxParams::method.
EnvValue expand_route
BATCHLAS_EXPAND_ROUTE = expand | loop: pins the scratch-expansion route of hemm, herk and her2k,...
EnvValue ortho_gram
BATCHLAS_ORTHO_GRAM: only the exact value gemm has an effect (forces the GEMM gram route in place of ...
EnvValue getrf_laswp
BATCHLAS_GETRF_LASWP = inloop | defer_walk | defer_gather (default).
EnvValue getrf_right_laswp
BATCHLAS_GETRF_RIGHT_LASWP = walk | gather; unset takes the measured crossover.
EnvValue geqrf_leaf
BATCHLAS_GEQRF_LEAF = auto (default) | reg (the register panel leaf wherever it fits).
EnvValue syevx_preconditioner
BATCHLAS_SYEVX_PRECONDITIONER: overrides the SyevxParams default; loses to an explicit request and to...
EnvValue syevx_filter_degree_auto
BATCHLAS_SYEVX_FILTER_DEGREE_AUTO: derive the Chebyshev filter degree automatically.
EnvValue gesvd_bidiag
BATCHLAS_GESVD_BIDIAG = bdsdc | normal | bdsqr.
EnvValue syevx_instr_host
BATCHLAS_SYEVX_INSTR_HOST: forces the host instrumentation path.
EnvValue iluk_device
BATCHLAS_ILUK_DEVICE: only a first character of 0 or 1 is inspected; true, on and yes fall through to...
EnvValue sb2st_subgroup
BATCHLAS_SB2ST_SUBGROUP = auto | on | off (case-folded).
EnvValue latrd_impl
BATCHLAS_LATRD_IMPL = legacy | device | grid. Re-read per call.
Everything BatchLAS reads from its environment, in one value.
DiagnosticsSettings diagnostics
Tracing, dumping, profiling, opt-in checks.
UnsafeSettings unsafe
Overrides that remove a guarantee.
SelectionSettings selection
Kernel and algorithm selection.
GeometrySettings geometry
Launch geometry and tuning thresholds.
RoutingSettings routing
Route pins (BATCHLAS_<OP>_ROUTE).
The overrides that remove a guarantee: setting one can make a correct program crash,...
BlasHealth blas_health
BATCHLAS_BLAS_HEALTH = off | warn | error.
bool skip_pointer_checks
BATCHLAS_SKIP_POINTER_CHECKS: disables the per-argument USM reachability check that turns host memory...
bool latrd_grid_force_unsafe
BATCHLAS_LATRD_GRID_FORCE_UNSAFE (env_truthy): lets BATCHLAS_LATRD_GRID_GROUPS exceed the co-residenc...
BlasHealth
Behaviour of the host-dgemm health probe (BATCHLAS_BLAS_HEALTH).
@ Warn
warn (default): warn when the probe fails.