Skip to content

Initial EV3 Support - #925

Open
Caio Rocha (caiocbr) wants to merge 11 commits into
mainfrom
caiorocha/ev3_integration
Open

Caio Rocha (caiocbr) wants to merge 11 commits into
mainfrom
caiorocha/ev3_integration

Conversation

@caiocbr

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 20:44
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Tiny accepted scales can overflow the precomputed reciprocal and incorrectly dequantize finite nonzero FP8 values to infinity.

3 open findings
What changed in this PR

Adds latency RANK_MAJOR static-scale FP8 support and replay-safe CUDA graph synchronization.

Changes:

  • Propagates static FP8 scales through C++, bindings, and Python APIs.
  • Adds FP8 dispatch/combine kernels and graph-replay rendezvous.
  • Expands validation, documentation, and tests.
File Description
src/​ext/​ep/​latency.cc Validates and propagates quantization scales.
src/​ext/​ep/​include/​moe_runtime_context.hpp Retains scale in dispatch handles.
src/​ext/​ep/​include/​kernels.hpp Adds scale to kernel workloads.
src/​ext/​ep/​dispatch/​rank_major_dispatch.cu Supports FP8 payloads and replay invalidation.
src/​ext/​ep/​dispatch/​common.cuh Selects rank-major FP8 kernels.
src/​ext/​ep/​common/​quantization.cuh Adds scalar FP8 dequantization.
src/​ext/​ep/​combine/​rank_local_reduce_combine.cu Enables FP8 rank-local combine.
src/​ext/​ep/​combine/​direct_send_combine.cu Enables FP8 direct-send combine.
src/​ext/​ep/​combine/​common.cuh Implements FP8 reduction and replay synchronization.
src/​ext/​ep/​bindings.cpp Exposes quantization scale to Python.
python/​test/​test_ep.py Tests FP8 validation, correctness, and replay.
python/​mscclpp/​ep/​utils.py Validates and resolves scalar scales.
python/​mscclpp/​ep/​types.py Extends the public quantization model.
python/​mscclpp/​ep/​request_builder.py Builds FP8 dispatch/combine requests.
python/​mscclpp/​ep/​README.md Documents FP8 and graph replay contracts.
python/​mscclpp/​ep/​communicator.py Updates combine API documentation.
include/​mscclpp/​ext/​ep/​types.hpp Extends the public C++ request API.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/ext/ep/common/quantization.cuh Outdated
packed.data[0] = value;
packed.data[1] = value;
const float converted = mscclpp::to<mscclpp::f32x2>(packed).data[0];
return converted == 0.0f ? converted : converted * dequantScale;
Comment on lines +152 to +156
/// Static FP8 quantization multiplier for latency RANK_MAJOR.
///
/// The input is already quantized as E4M3(real * quantScale). Combine
/// dequantizes matching expert output with 1 / quantScale.
float quantScale = 1.0f;
Comment thread python/mscclpp/ep/types.py Outdated
Comment on lines +28 to +30
Latency RANK_MAJOR instead accepts externally quantized FP8 and uses the
scalar multiplier ``scale``: values are stored as E4M3 after multiplication
by ``scale`` and dequantized during combine with ``1 / scale``.
Comment thread src/ext/ep/common/quantization.cuh Outdated
Comment thread src/ext/ep/dispatch/rank_major_dispatch.cu Outdated
Copilot AI balanced review requested due to automatic review settings October 15, 2026 21:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The benchmark reuses overwritten or stale expert results and rejects supported single-round rank-major graphs.

5 open findings

🧠 Review effort: Balanced

Comment on lines +168 to +169
def combine_fn(dout):
moe.combine(expert_output, dout[1], out=out)
Comment on lines +86 to +87
if args.cuda_graph and latency and args.iters_per_graph < 2:
raise ValueError("MSCCL++ latency graph replay requires --iters-per-graph >= 2 to avoid reusing one epoch")
Copilot AI balanced review requested due to automatic review settings October 15, 2026 22:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Previously reported dequantization overflow and benchmark buffer-reuse correctness issues remain unresolved.

5 open findings

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 16, 2026 01:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Benchmark overflow handling can strand MPI peers, and throughput kernel profiling omits required synchronization.

6 open findings
Previously missed (1)

In code that hasn't changed since last review

Medium severity Include peer synchronization in dispatch profiler filtering

python/​mscclpp_benchmark/​ep/​ep_bench_mscclpp.py:17

Match synchronizeThroughputPeersKernel in the dispatch profiler filter. Reused preparation launches this kernel before every throughput dispatch (src/ext/ep/throughput.cc:229–232), but its name contains neither dispatch nor synchronizepeers. Kineto therefore omits the required peer synchronization from dispatch and total kernel timings, overstating performance. Include synchronizethroughputpeers in the matching substrings.

🧠 Review effort: Balanced

Comment on lines +109 to +110
if x.float().abs().max().item() * args.static_fp8_scale > fp8_max:
raise ValueError("--static-fp8-scale overflows the generated activations")
Copilot AI balanced review requested due to automatic review settings October 16, 2026 23:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

output, expertOutput, topkIndices, topkWeights, nTokens, nTopk, nExperts, nRanks, maxTokensPerRank, epoch,
transport, workspaceView, sharedMemory);
transport, workspaceView, sharedMemory,
DispatchType == DispatchDataType::FP8_E4M3 ? 1.0f / workload.quantScale_ : 1.0f);
Copilot AI balanced review requested due to automatic review settings October 19, 2026 20:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

FP8 scaling can produce incorrect non-finite results, and benchmark profiling omits a required synchronization kernel.

8 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Include throughput synchronization kernel in dispatch timing

python/​mscclpp_benchmark/​ep/​ep_bench_mscclpp.py:17

[P2] Include the throughput synchronization kernel in dispatch timing. This benchmark reuses preparation, so each dispatch launches synchronizeThroughputPeersKernel before throughputDispatchKernel (src/ext/ep/throughput.cc:230–239). Neither current substring matches the synchronization kernel, so Kineto omits this required peer barrier from dispatch and total communication latency. Match its actual name as well.

Review effort: Balanced

Comment thread src/ext/ep/common/quantization.cuh Outdated
Comment on lines +91 to +92
const float accumulationScale = dequantScale * sourceWeight;
const mscclpp::f32x2 scales = make_float2(accumulationScale, accumulationScale);
Copilot AI balanced review requested due to automatic review settings October 19, 2026 20:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment on lines +76 to +80
const mscclpp::f32x2 scales = make_float2(accumulationScale, accumulationScale);
#pragma unroll
for (int pair = 0; pair < mscclpp::f32x8::Size / mscclpp::f32x2::Size; ++pair) {
accumulated[pair] = mscclpp::fma(convertedPairs[pair], scales, accumulated[pair]);
}
Copilot AI balanced review requested due to automatic review settings October 19, 2026 22:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/// Return the runtime-owned BF16 combine input buffer.
/// Return the runtime-owned combine input buffer.
///
/// BF16 and MXFP8_E4M3 dispatches use BF16 expert output; FP8_E4M3 uses E4M3.

def parse_kineto_kernels(key_averages):
return (
sum_matching_kernel_us(key_averages, ("dispatch", "synchronizepeers")),
Comment on lines +199 to +200
const float accumulationScale = IsDirectSend ? dequantScale * sourceWeight : dequantScale;
dequantizeAndAccumulateFp8E4M3(values, accumulationScale, reduced);
Copilot AI balanced review requested due to automatic review settings October 19, 2026 22:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Scale validation and synthetic benchmark weights permit numerical overflow that can produce invalid FP8 combine results.

12 open issues
2 previously missed issues

In code that hasn't changed since last review

Medium severity Bound routing weights to prevent FP8 partial overflow

python/​mscclpp_benchmark/​ep/​ep_bench_common.py:120

[P2] Bound the synthetic routing weights so static FP8 rank-local partials remain representable. These unnormalized weights can make a weighted partial overflow even when the input passes the scale check. For example, four unit-weight routes to one rank turn a value of -128 into -512 at scale 1, outside E4M3's finite range. _stage_expert_output then produces NaNs and --validate fails before timing. Normalize each token's nonnegative weights, or choose the scale using the weighted partials as well as the inputs.

Medium severity Reject scales with nonfinite FP32 reciprocals

src/​ext/​ep/​latency.cc:169

[P2] Reject scales whose FP32 reciprocal is nonfinite. A positive finite scale such as 1e-39f passes this check, but both rank-major combine kernels compute 1.0f / quantScale, producing infinity. Even a zero FP8 expert value then produces NaN during accumulation when its contribution is processed. Require a finite reciprocal before launching and add a regression case for this scale.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 20, 2026 17:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Accepted scales can produce NaN results, and optional PyTorch imports can break benchmark test collection.

13 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Reject scales with overflowing FP32 reciprocals

src/​ext/​ep/​latency.cc:174

Reject scales whose FP32 reciprocal overflows. A finite positive scale such as 2^-130 passes this check, but both static-FP8 combine kernels compute 1.0f / quantScale, producing infinity. Even an all-zero expert row then produces NaNs through fma(0, infinity, accumulator). Require a finite reciprocal before launching, and add a regression case for this scale.

Review effort: Balanced

_encode_correctness_input,
_stats_values,
)
from mscclpp_benchmark.ep.ep_bench_mscclpp import parse_kineto_kernels
/// Return the runtime-owned BF16 combine input buffer.
/// Return the runtime-owned combine input buffer.
///
/// BF16 and MXFP8_E4M3 dispatches use BF16 expert output; FP8_E4M3 uses E4M3.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we provide a config for this? Default is bf16. user can set the datatype for combine

};

/// Input representation for latency rank-major static FP8 dispatch.
enum class StaticFp8InputMode {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we move this to quantization config

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8d8ddd35-a846-4674-b731-976ade7a13d8
Copilot AI balanced review requested due to automatic review settings October 21, 2026 02:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Accepted static FP8 scales can overflow during reciprocal calculation and produce NaN combine outputs.

13 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Reject scales with non-finite FP32 reciprocals

src/​ext/​ep/​latency.cc:174

[P2] Reject scales whose FP32 reciprocal is not finite. A scale such as 1e-40f passes this validation, but both rank-major static-FP8 combine kernels compute 1.0f / workload.quantScale_, which overflows to infinity. Even an all-zero expert row then produces NaNs through 0 * infinity. Check that the FP32 reciprocal is finite before launching.

Review effort: Balanced

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants