Skip to content

Reject recursive function graph attributes - #32864

Open
danielsongmicrosoft wants to merge 1 commit into
microsoft:mainfrom
danielsongmicrosoft:user/danielsongmicrosoft/onnxruntime-robustness-f9e64d0976dc
Open

danielsongmicrosoft wants to merge 1 commit into
microsoft:mainfrom
danielsongmicrosoft:user/danielsongmicrosoft/onnxruntime-robustness-f9e64d0976dc

Conversation

@danielsongmicrosoft

Copy link
Copy Markdown
Contributor

Summary

  • Detect recursive GRAPH and GRAPHS default-attribute expansion during function specialization.
  • Preserve valid non-recursive and sequential attribute reuse.

Validation

  • Warnings-as-errors build completed successfully.
  • Focused recursive and non-recursive function specialization tests passed.

@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.

Copilot review overview

🟢 Approval recommended

The cycle tracking is scoped correctly, errors propagate to callers, and tests cover recursive and valid reuse paths.

Review effort: Balanced
Findings: None

What changed in this PR

Adds cycle detection to function specialization, preventing recursive GRAPH/GRAPHS attribute expansion from causing unbounded recursion.

Changes:

  • Tracks active graph-attribute references and returns a diagnostic cycle chain.
  • Propagates specialization failures through function inlining.
  • Tests recursive, non-recursive, and sequential reuse scenarios.
File Description
onnxruntime/​core/​graph/​function_utils.cc Implements cycle detection and status propagation.
onnxruntime/​core/​graph/​function_utils.h Changes specialization APIs to return Status.
onnxruntime/​core/​graph/​graph.cc Propagates specialization errors during inlining.
onnxruntime/​test/​framework/​function_test.cc Adds focused graph-attribute recursion tests.

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

@danielsongmicrosoft
danielsongmicrosoft marked this pull request as ready for review September 28, 2026 19:55

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.

2 participants