Skip to content

Revert "Fix unchecked map access in xnnpack"#18826

Merged
lucylq merged 1 commit intomainfrom
revert-18804-security36
Apr 10, 2026
Merged

Revert "Fix unchecked map access in xnnpack"#18826
lucylq merged 1 commit intomainfrom
revert-18804-security36

Conversation

@lucylq
Copy link
Copy Markdown
Contributor

@lucylq lucylq commented Apr 10, 2026

Reverts #18804, which is breaking windows tests

Copilot AI review requested due to automatic review settings April 10, 2026 23:21
@pytorch-bot pytorch-bot Bot added the ci-no-td label Apr 10, 2026
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 10, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18826

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

⏳ No Failures, 134 Pending

As of commit 8996980 with merge base de61304 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@lucylq lucylq requested a review from digantdesai as a code owner April 10, 2026 23:21
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 10, 2026
@github-actions
Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reverts prior changes that replaced unchecked remapped_ids.at(...) lookups with a non-throwing helper in the XNNPACK runtime compiler.

Changes:

  • Removes the remapId() safe-lookup helper.
  • Restores direct std::unordered_map::at() access for remapped tensor IDs across multiple define*Node helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 604 to 606
#define MAYBE_UNUSED(x) (void)(x)

// Safe lookup in remapped_ids that returns an error instead of throwing
// from std::unordered_map::at() in noexcept functions.
inline Result<uint32_t> remapId(
const std::unordered_map<uint32_t, uint32_t>& map,
uint32_t key) {
auto it = map.find(key);
if (it == map.end()) {
ET_LOG(Error, "Remapped id not found for key %u", key);
return Error::Internal;
}
return it->second;
}

#ifdef ENABLE_XNNPACK_KLEIDI
Comment on lines +682 to +685
xnn_status status = xnn_define_convert(
subgraph_ptr,
remapped_ids.at(graph_node->input_id()),
remapped_ids.at(graph_node->output_id()),
Comment on lines 1520 to +1526
xnn_status status = xnn_define_unary(
subgraph_ptr, op_type, params, remapped_input, remapped_output, flags);
subgraph_ptr,
op_type,
params,
remapped_ids.at(input_id),
remapped_ids.at(output_id),
flags);
Comment on lines 1643 to 1647
params,
bin_in1,
bin_in2,
bin_out,
remapped_ids.at(graph_node->input1_id()),
remapped_ids.at(graph_node->input2_id()),
remapped_ids.at(graph_node->output_id()),
graph_node->flags());
@lucylq lucylq merged commit 411ede2 into main Apr 10, 2026
160 of 168 checks passed
@lucylq lucylq deleted the revert-18804-security36 branch April 10, 2026 23:31
jpiat pushed a commit to jpiat/executorch that referenced this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-td CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants