Skip to content

feat(lance-fold): consume upstream graph-hop kernel on Rust 1.99 - #3

Merged
AdaWorldAPI merged 6 commits into
masterfrom
feat/consume-lance-graph-hop-rust199-20261019
Oct 19, 2026
Merged

AdaWorldAPI merged 6 commits into
masterfrom
feat/consume-lance-graph-hop-rust199-20261019

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Why

Follow up to merged petgraph #2 and dependent on AdaWorldAPI/lance-graph#1616. The first fork-side experiment established that Mask-RISC executes a directed BFS one-hop parity query. Move the reusable execution out of the fork, leaving a minor petgraph bridge, exactly as intended by the fork-first plan.

Change

  • The fork's lance::one_hop now delegates to lance-graph-mask-risc::OutgoingHop; the local Gather/Gather/Scatter lowering and visibility-shape implementation are removed.
  • Existing petgraph BFS differential tests remain, plus a new multi-seed, two-witness test reusing the upstream plan and scratch.
  • Pin the optional lance-graph git dependency to the exact upstream #1616 head revision 66636da46107edcc3280237db088172f652cacd5.
  • Add fork development rust-toolchain.toml at 1.99.0 (rustfmt + clippy), explicit Rust 1.99 for the experiment crate, and set its GitHub Actions runner to 1.99.0.

Cargo/MSRV contract

Pinning the compiler also pins the Cargo toolchain. The fork retains petgraph's upstream rust-version = 1.85 compatibility declaration; only the isolated experiment requires 1.99. Blanket cargo upgrade of dependency ranges is intentionally out of scope, as it would conflate toolchain migration with library dependency changes and the repo has no tracked root Cargo.lock.

Validation

  • Upstream lance-graph#1616 compile/test/style check green
  • This fork's Lance fold hop probe test green under 1.99.0
  • Standard petgraph CI unchanged and green
  • Only after both PRs pass: merge lance-graph first, petgraph second

Next

Explore a properly witnessed continuation contract for multiple graph folds (BFS/Gremlin repeat) without sneaking a materialized projection back into the fold algebra. Extract lance-graph-core only after actual consumers establish the minimal contract.

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 19, 2026 15:38
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T15:42:21.622358Z cd4dc4b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd4dc4bfce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rust-toolchain.toml
@@ -0,0 +1,8 @@
[toolchain]
channel = "1.99.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the lint job on nightly

The Lints job in .github/workflows/ci.yml installs nightly but then invokes unqualified cargo through just fmt, just clippy, and cargo doc. The checked-in toolchain file takes precedence over rustup's default toolchain, while dtolnay/rust-toolchain only installs and sets nightly as the default, so this job will select or attempt to install stable 1.99 instead. In particular, stable rustfmt ignores this repository's nightly-only rustfmt.toml options, weakening the formatting check; remove the pin for this job or invoke the commands with +nightly. This precedence is documented in the rustup override documentation.

Useful? React with 👍 / 👎.

Comment on lines +43 to +45
let mut frontier = vec![0; words_for(snapshot.node_rows)];
frontier[seed / 64] |= 1u64 << (seed % 64);
let mut targets = vec![0u64; words_for(snapshot.node_rows)];

if edges.sources.is_empty() {
return Ok(targets);
}

let planes_masks = [snapshot.live_edges];
let lanes = [
LaneRef::U32(edges.sources),
LaneRef::U32(edges.targets),
];
let planes = Planes {
n_rows: edges.sources.len(),
masks: &planes_masks,
lanes: &lanes,
};
let foreign_planes = [
ForeignPlane { words: &frontier, rows: snapshot.node_rows },
ForeignPlane { words: snapshot.visible_nodes, rows: snapshot.node_rows },
];
let foreign = Foreign { planes: &foreign_planes, lanes: &[] };
let program = Program::new(
vec![
MaskOp::Gather {
lane: 0,
foreign: 0,
under: Some(Operand::Plane(0)),
dst: 0,
},
MaskOp::Gather {
lane: 1,
foreign: 1,
under: Some(Operand::Scratch(0)),
dst: 1,
},
],
Terminal::ScatterOrU32 {
mask: Operand::Scratch(1),
lane: 1,
out_rows: snapshot.node_rows as u32,
},
);
let mut scratch = Scratch::for_program(&program, edges.sources.len())
.map_err(|error| HopError::Executor(format!("{error:?}")))?;
execute_into(
&program, &planes, &foreign, &mut scratch, Out::Mask(&mut targets),
)
.map_err(|error| HopError::Executor(format!("{error:?}")))?;

Ok(targets)
let mut out = vec![0; words_for(snapshot.node_rows)];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate snapshot shapes before allocating row masks

For malformed input whose claimed node_rows is large but whose visibility mask contains the selected seed word, these two allocations happen before kernel.run can validate the snapshot masks and edge lanes. A caller can therefore make one_hop reserve up to roughly 1 GiB for a u32-addressable graph and potentially abort on allocation, whereas the removed implementation returned InvalidShape before allocating. Validate the full upstream snapshot/edge shape before constructing frontier and out.

Useful? React with 👍 / 👎.

@AdaWorldAPI
AdaWorldAPI merged commit fdd650c into master Oct 19, 2026
16 checks passed
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.

1 participant