MCPcopy Create free account
hub / github.com/NVIDIA/SOL-ExecBench / BuildSpec

Class BuildSpec

src/sol_execbench/core/data/solution.py:131–231  ·  view source on GitHub ↗

Build specification for a solution implementation. Contains all technical specifications required to build and execute a solution, including language, hardware targets, dependencies, entry point, and build commands.

Source from the content-addressed store, hash-verified

129
130
131class BuildSpec(BaseModelWithDocstrings):
132 """Build specification for a solution implementation.
133
134 Contains all technical specifications required to build and execute a solution, including
135 language, hardware targets, dependencies, entry point, and build commands.
136 """
137
138 languages: list[SupportedLanguages]
139 """The list of programming languages used to implement the solution. C++ languages and Python languages cannot be mixed."""
140 target_hardware: list[SupportedHardware] = Field(min_length=1)
141 """List of hardware this solution is compatible with (e.g., B200, LOCAL)."""
142 entry_point: NonEmptyString
143 """The exact path to the function to be called. Format: '{file_path}::{function_name}'
144 (e.g., 'main.py::run')."""
145 dependencies: list[NonEmptyString] = Field(default_factory=list)
146 """Optional list of required libraries or packages. E.g. for CUDA, we support 'cublas',
147 'cudnn', 'cutlass'"""
148 destination_passing_style: bool = True
149 """Whether to use destination passing style for the solution. If True, the solution should
150 accept the output tensors as the last arguments. If False, the solution should return the
151 output tensors."""
152 binding: Optional[SupportedBindings] = None
153 """The binding type to use for C++/CUDA solutions. If None, defaults to 'torch' for
154 C++/CUDA languages. Ignored for Python and Triton languages."""
155 compile_options: Optional[CompileOptions] = None
156 """Optional compiler and linker flags. Only used for C++/CUDA solutions with torch binding."""
157
158 @model_validator(mode="after")
159 def _validate_entry_point(self) -> "BuildSpec":
160 """Validate entry_point format.
161
162 Raises
163 ------
164 ValueError
165 If entry_point doesn't follow the required format.
166 """
167 if self.entry_point.count("::") != 1:
168 raise ValueError(
169 f"Invalid entry point format: {self.entry_point}. Expected "
170 '"<file_path>::<function_name>".'
171 )
172 return self
173
174 @model_validator(mode="after")
175 def _validate_languages(self) -> "BuildSpec":
176 """Validate languages support matrix.
177
178 Raises
179 ------
180 ValueError
181 If the languages are not valid.
182 """
183
184 python_languages = [
185 SupportedLanguages.PYTORCH,
186 SupportedLanguages.TRITON,
187 SupportedLanguages.CUTE_DSL,
188 SupportedLanguages.CUTILE,

Callers 1

_make_specFunction · 0.90

Calls

no outgoing calls

Tested by 1

_make_specFunction · 0.72