Skip to content

Add no-op platform implementations for dry-run testing#113

Merged
Jack-Khuu merged 4 commits intoplatform/registryfrom
platform/noop
Mar 3, 2026
Merged

Add no-op platform implementations for dry-run testing#113
Jack-Khuu merged 4 commits intoplatform/registryfrom
platform/noop

Conversation

@Jack-Khuu
Copy link
Contributor

@Jack-Khuu Jack-Khuu commented Mar 3, 2026

No-op implementations pass the input kernel through unchanged, useful for reference, CI environments without GPU hardware, and integration tests.

  • noop.py: NoOpVerifier (returns True), NoOpBenchmarker (returns 1.0ms placeholder), NoOpWorkerRunner (returns parent kernel as success), plus worker-level stubs (NoOpSpecsProvider, NoOpProfiler, NoOpRooflineAnalyzer, NoOpBottleneckAnalyzer, NoOpRAGPrescriber).
  • registry.py: register all noop implementations under "noop" name.
  • examples/configs/noop.yaml: greedy strategy with platform: noop.

python examples/run_opt_manager.py \
       --kernel-dir examples/optimize_01_matvec 

No-op implementations pass the input kernel through unchanged, useful
for CI environments without GPU hardware and integration tests.

- noop.py: NoOpVerifier (returns True), NoOpBenchmarker (returns 1.0ms
  placeholder), NoOpWorkerRunner (returns parent kernel as success),
  plus worker-level stubs (NoOpSpecsProvider, NoOpProfiler,
  NoOpRooflineAnalyzer, NoOpBottleneckAnalyzer, NoOpRAGPrescriber).
- registry.py: register all noop implementations under "noop" name.
- __init__.py: re-export noop classes.
- examples/configs/noop.yaml: greedy strategy with platform: noop.
@Jack-Khuu Jack-Khuu requested a review from kaiming-cheng March 3, 2026 01:12
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 3, 2026
Copy link
Contributor

@kaiming-cheng kaiming-cheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

- Add gpu_name and other worker kwargs to the --config path in
  run_opt_manager.py (were always passed in hardcoded paths).
- Fix openai_model inconsistency across YAML configs.
- Pass profiling_semaphore to fallback KernelProfiler construction
  so NCU profiling is properly serialized.
When a decorated function has **kwargs, apply_defaults() stores them
as {param_name: {}} in bound_args.arguments. Calling func(**result)
then passes that as a keyword arg, nesting it inside the real **kwargs.

Expand VAR_KEYWORD entries before returning so they stay flat.
@Jack-Khuu
Copy link
Contributor Author

Note that the changes in this PR are fairly trivial (just the first commit), but this PR also has the forward fix for the stack

@Jack-Khuu Jack-Khuu merged commit b1ed6a2 into platform/registry Mar 3, 2026
1 check passed
Jack-Khuu added a commit that referenced this pull request Mar 3, 2026
…d no-op platform implementations for dry-run testing (#113)

* Add platform component registry for config-driven selection

Introduce PlatformRegistry that maps (component_key, impl_name) pairs
to factory callables.  YAML configs like `platform: {verifier: nvidia}`
now drive component selection at runtime.

- registry.py: PlatformRegistry with register/create/create_from_config
  and _filter_kwargs for signature-safe factory construction.  Built-in
  nvidia implementations registered at import time.
- opt_manager.py: @config_injectable decorator, new `platform` param,
  _resolve_platform() replaces three _default_* factory methods.
  Worker-level config (string names) propagated via worker_kwargs.
- opt_worker.py: new `platform_config` param and
  _resolve_platform_config() to resolve worker-level components from
  the registry in each worker process.
- examples/configs/: beam_search.yaml, greedy.yaml, nvidia.yaml
- run_opt_manager.py: --config CLI option for config-driven construction

* Add no-op platform implementations for dry-run testing (#113)

* Add no-op platform implementations for dry-run testing

No-op implementations pass the input kernel through unchanged, useful
for CI environments without GPU hardware and integration tests.

- noop.py: NoOpVerifier (returns True), NoOpBenchmarker (returns 1.0ms
  placeholder), NoOpWorkerRunner (returns parent kernel as success),
  plus worker-level stubs (NoOpSpecsProvider, NoOpProfiler,
  NoOpRooflineAnalyzer, NoOpBottleneckAnalyzer, NoOpRAGPrescriber).
- registry.py: register all noop implementations under "noop" name.
- __init__.py: re-export noop classes.
- examples/configs/noop.yaml: greedy strategy with platform: noop.

* Fix missing worker kwargs in config-driven construction

- Add gpu_name and other worker kwargs to the --config path in
  run_opt_manager.py (were always passed in hardcoded paths).
- Fix openai_model inconsistency across YAML configs.
- Pass profiling_semaphore to fallback KernelProfiler construction
  so NCU profiling is properly serialized.

* Fix config_injectable VAR_KEYWORD double-nesting bug

When a decorated function has **kwargs, apply_defaults() stores them
as {param_name: {}} in bound_args.arguments. Calling func(**result)
then passes that as a keyword arg, nesting it inside the real **kwargs.

Expand VAR_KEYWORD entries before returning so they stay flat.

* forward fix bugs
Jack-Khuu added a commit that referenced this pull request Mar 3, 2026
* Add outer platform interfaces and extract NVIDIA impls from opt_manager

Introduce KernelVerifier, KernelBenchmarker, and WorkerRunner abstract
interfaces that define the seams where platform-specific code enters
OptimizationManager.

Extract the existing NVIDIA-specific code (verification via
VerificationWorker, benchmarking via Benchmark, worker spawning via
mp.Process) into NvidiaVerifier, NvidiaBenchmarker, and
NvidiaWorkerRunner classes that implement these interfaces.

OptimizationManager now delegates to self.verifier, self.benchmarker,
and self.worker_runner instead of inlining the NVIDIA code. No
behavioral changes — the same NVIDIA defaults are always constructed.

* Add inner-worker platform interfaces and NVIDIA implementations

Add 5 worker-level abstract interfaces for components inside
OptimizationWorker: AcceleratorSpecsProvider, KernelProfilerBase,
RooflineAnalyzerBase, BottleneckAnalyzerBase, RAGPrescriberBase.

Add NVIDIA wrapper implementations that lazily delegate to the existing
concrete classes (KernelProfiler, RooflineAnalyzer, BottleneckAnalyzer,
RAGPrescriber, get_gpu_specs).

Add platform_components dict parameter to OptimizationWorker so
registry-resolved components can be injected from the manager level.
_init_components() checks platform_components before falling back to
the default NVIDIA construction.

* Add platform component registry for config-driven selection (#112) Add no-op platform implementations for dry-run testing (#113) 

* Add platform component registry for config-driven selection

Introduce PlatformRegistry that maps (component_key, impl_name) pairs
to factory callables.  YAML configs like `platform: {verifier: nvidia}`
now drive component selection at runtime.

- registry.py: PlatformRegistry with register/create/create_from_config
  and _filter_kwargs for signature-safe factory construction.  Built-in
  nvidia implementations registered at import time.
- opt_manager.py: @config_injectable decorator, new `platform` param,
  _resolve_platform() replaces three _default_* factory methods.
  Worker-level config (string names) propagated via worker_kwargs.
- opt_worker.py: new `platform_config` param and
  _resolve_platform_config() to resolve worker-level components from
  the registry in each worker process.
- examples/configs/: beam_search.yaml, greedy.yaml, nvidia.yaml
- run_opt_manager.py: --config CLI option for config-driven construction

* Add no-op platform implementations for dry-run testing (#113)

* Add no-op platform implementations for dry-run testing

No-op implementations pass the input kernel through unchanged, useful
for CI environments without GPU hardware and integration tests.

- noop.py: NoOpVerifier (returns True), NoOpBenchmarker (returns 1.0ms
  placeholder), NoOpWorkerRunner (returns parent kernel as success),
  plus worker-level stubs (NoOpSpecsProvider, NoOpProfiler,
  NoOpRooflineAnalyzer, NoOpBottleneckAnalyzer, NoOpRAGPrescriber).
- registry.py: register all noop implementations under "noop" name.
- __init__.py: re-export noop classes.
- examples/configs/noop.yaml: greedy strategy with platform: noop.

* Fix missing worker kwargs in config-driven construction

- Add gpu_name and other worker kwargs to the --config path in
  run_opt_manager.py (were always passed in hardcoded paths).
- Fix openai_model inconsistency across YAML configs.
- Pass profiling_semaphore to fallback KernelProfiler construction
  so NCU profiling is properly serialized.

* Fix config_injectable VAR_KEYWORD double-nesting bug

When a decorated function has **kwargs, apply_defaults() stores them
as {param_name: {}} in bound_args.arguments. Calling func(**result)
then passes that as a keyword arg, nesting it inside the real **kwargs.

Expand VAR_KEYWORD entries before returning so they stay flat.

* forward fix bugs

* lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants