Quadrants 1.0.0#41
Merged
Merged
Conversation
…enesis-Embodied-AI#425) Co-authored-by: v01dxyz <v01dxyz@v01d.xyz>
Co-authored-by: v01dxyz <v01dxyz@v01d.xyz>
…I#473) Co-authored-by: Hugh Perkins <hughperkins@gmail.com>
…ed-AI#695) Co-authored-by: Cursor <cursoragent@cursor.com>
Brings the AMD fork up to upstream Quadrants v1.0.0 (5d68fc4). Conflict resolutions reuse the prior reconciliation work on merge/upstream-main-2026-05-08 and apply only the extra upstream delta (4155735..v1.0.0) on top of it per-file, leaving manual work to the spots where the new upstream delta overlapped AMD-specific edits. Notable semantic resolutions: - runtime/amdgpu/kernel_launcher.cpp: keep the AMD launch rework (resolved- function cache + kernarg-by-value `AMDGPUContext::launch` + `device_runtime_context_ptr_for_adstack` signature) while integrating upstream's new `dispatch_max_reducers_for_tasks` call and stream-parallel- group dispatch onto that path (set_stream around the AMD launch helper, since `AMDGPUContext::launch` dispatches on the context's current stream). - codegen/amdgpu/codegen_amdgpu.cpp (visit GlobalLoadStmt): keep the AMD read-only `invariant.load` byte-pointer fast path and add upstream's bit-pointer `QD_ASSERT(!is_volatile)` guard; volatile byte loads are handled by the merged base `create_global_load`, which now supports both volatile and read-only. Also carry both `dynamic_shared_array_bytes` (AMD) and `stream_parallel_group_id` (upstream) on the emitted task. - ir / lower_ast / frontend_ir: keep both the AMD `force_inline` and the upstream `stream_parallel_group_id` loop fields/plumbing. - amdgpu_context.h: keep AMD `kernel_arg_pointer_` plus upstream stream pool members (`stream_`, `stream_pool_`). Co-authored-by: Cursor <cursoragent@cursor.com>
The amd-integration fork had cherry-picked the HIP graph driver functions (graph_create / graph_destroy / graph_add_kernel_node / graph_instantiate / graph_exec_destroy / graph_launch), and upstream v1.0.0 added the same set. The per-file 3-way merge appended both copies into amdgpu_driver_functions.inc.h, producing redeclaration errors that broke the AMDGPU RHI/runtime compile. Drop the upstream duplicate block; the signatures are identical to the fork's existing declarations. Co-authored-by: Cursor <cursoragent@cursor.com>
…1.0.0 merge - kernel_launcher.cpp: the 3-way merge spliced upstream v1.0.0's launch_llvm_kernel rewrite (ephemeral arg/context buffers, explicit-stream path, AmdgpuDefaultStream PinGuard) onto the AMD fork's kernarg-by-value + persistent-scratch design, leaving references to undefined `ephemeral_context_ptr`. Restore the fork's coherent launch_llvm_kernel verbatim; it calls the (already merged) enhanced launch_offloaded_tasks, which keeps the max-reducer dispatch and stream-parallel groups adapted onto the AMD launch path. - llvm_context.h: both the fork and upstream added `num_instructions`; the merge kept upstream's private placement, but the AMDGPU codegen force-inline heuristic calls it statically from outside the class. Move it back to the public section. Co-authored-by: Cursor <cursoragent@cursor.com>
The v1.0.0 merge resolution regressed two amd-integration baseline
optimizations in launch_llvm_kernel / launch_offloaded_tasks:
- The per-launch result-buffer copy was a blocking memcpy_device_to_host,
forcing a host stall on every value-returning launch and serializing the
GPU pipeline. Restore the async D2H (the caller synchronizes lazily when it
needs the value); external-array transfers still stream_synchronize once
before reading back.
- launch_task constructed the kernarg std::vectors from initializer lists
({kernarg_payload} / {kernarg_size}) on every dispatch (heap alloc + free
per launch). Hoist arg_ptrs/arg_sizes out of the per-task launch and reuse.
Co-authored-by: Cursor <cursoragent@cursor.com>
…m on retarget Two AMDGPU JIT-compile crashes surfaced after the v1.0.0 merge pulled in the QIPC subgroup ops (Genesis-Embodied-AI#676), which made the rigid constraint solver's wave-cooperative reductions route through `amdgpu_cross_half_shuffle_i32`. Both manifested as a SIGSEGV inside `llvm::SIInstrInfo::getInstSizeInBytes` during `JITSessionAMDGPU::compile_module_to_hsaco` (i.e. at first kernel launch), and reproduce on gfx942 / MI300X. Baseline 0.4.6 never emitted these constructs, which is why it was unaffected. 1. Native `llvm.amdgcn.permlane64` lowering crashes the bundled LLVM 22.1.0 AMDGPU backend. Default `amdgpu_permlane64` to the existing LDS-roundtrip software emulation on every target (it produces identical results). Add `QD_AMDGPU_USE_NATIVE_PERMLANE64=1` to opt back into the native instruction once the backend bug is fixed; the old `QD_AMDGPU_FORCE_PERMLANE64_FALLBACK` is now the default and still honored. This is the actual crash fix. 2. The runtime module is compiled by the host x86_64 clang and only retargeted to amdgcn here, so `amdgpu_cross_half_shuffle_i32`'s `__asm__ volatile("" : "+v"(byte))` optimization barrier carries x86 flag clobbers (`~{dirflag},~{fpsr},~{flags}`) that are meaningless on AMDGPU. The IR verifies but the empty-body INLINEASM is invalid on the amdgcn target. Neutralize empty-body barrier asm during retarget (forward the tied value, then erase) so no stale host asm reaches codegen. On the wave64 targets we ship `ds_bpermute` already addresses the full wave, so the hint is a no-op. Co-authored-by: Cursor <cursoragent@cursor.com>
…ources CI pre-commit's clang-format hook reformatted these files (long declarations/lambda signatures collapsed onto single lines per the repo's clang-format config). Apply the same formatting so the hook passes. No functional changes. Co-authored-by: Cursor <cursoragent@cursor.com>
…b(0, input) clang-tidy (modernize-use-nullptr, -warnings-as-errors) flagged `builder->CreateSub(0, input)` in the i32 sgn path: the literal `0` binds to the `llvm::Value*` LHS parameter as a null pointer, not an integer zero. Replace with `builder->CreateNeg(input)`, which emits `0 - input` with a proper zero constant -- identical intended semantics, and clang-tidy clean. Co-authored-by: Cursor <cursoragent@cursor.com>
rtmadduri
approved these changes
Jun 8, 2026
Collaborator
Author
|
Unit tests are passing - with consistent results on |
peizhang56
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moving to rebase our changes off of the Quadrants 1.0.0 release.