Revert "Fix unchecked map access in xnnpack"#18826
Conversation
This reverts commit 273aee9.
🔗 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 SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ⏳ No Failures, 134 PendingAs of commit 8996980 with merge base de61304 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
There was a problem hiding this comment.
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 multipledefine*Nodehelpers.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #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 |
| xnn_status status = xnn_define_convert( | ||
| subgraph_ptr, | ||
| remapped_ids.at(graph_node->input_id()), | ||
| remapped_ids.at(graph_node->output_id()), |
| 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); |
| 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()); |
Reverts pytorch#18804, which is breaking windows tests
Reverts #18804, which is breaking windows tests