Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Interpretml Interpret ComputeAccessors

From Leeroopedia


Knowledge Sources
Domains Machine_Learning, EBM_Core
Last Updated 2026-02-07 12:00 GMT

Overview

Implements CPU instruction set detection and objective creation dispatch, selecting the optimal SIMD compute zone (AVX-512, AVX2, or CPU scalar) at runtime.

Description

The compute_accessors.cpp file provides the runtime CPU feature detection and compute zone dispatch logic. The DetectInstructionset function uses the CPUID instruction to determine which SIMD extensions are supported (SSE through AVX-512). The main functions GetObjective and CreateObjective use this information to select the best available compute zone for creating objectives. On Intel/AMD processors, it checks for AVX-512F and AVX2 support using both CPUID flags and XGETBV to verify OS support for saving/restoring extended registers. The cpuid and xgetbv helper functions are implemented with platform-specific inline assembly for MSVC, GCC/Clang, and other compilers. When AVX-512 or AVX2 are available, the corresponding zone-specific CreateObjective function is called; otherwise, it falls back to the CPU scalar implementation.

Usage

Called during boosting and interaction initialization to create the appropriate objective function instances. The detection runs once and selects the optimal SIMD path for the current CPU, maximizing training performance.

Code Reference

Source Location

Signature

inline static void cpuid(int cpuInfo[4], int function_id, int subfunction_id = 0);
inline static uint64_t xgetbv(int xcr);
static int DetectInstructionset();

// Zone-specific objective creation (conditionally compiled):
// CreateObjective_avx512f_32(...)
// CreateObjective_avx2_32(...)
// CreateObjective_cpu_64(...)

I/O Contract

Function Input Output Description
DetectInstructionset (none) int level Detected SIMD instruction set level
cpuid function_id, subfunction_id cpuInfo[4] CPU feature flags via CPUID instruction
xgetbv xcr register id uint64_t Extended control register value

Usage Examples

# Called internally via native bindings
from interpret.glassbox import ExplainableBoostingClassifier
ebm = ExplainableBoostingClassifier()
ebm.fit(X, y)  # compute_accessors detects CPU SIMD capabilities at startup

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment