Skip to content

Conversation

GregoryComer
Copy link
Member

@GregoryComer GregoryComer commented Sep 17, 2025

Summary

The regnet_y_32gf model from torchvision does not lower on XNNPACK. This is because a "-" in a generated weight name (from conv + bn fusion) causes things to blow up. I've updated the fusion logic to properly sanitize the generated weight name and added a test for regnet to validate the fix.

Here's the part of the eager mode model responsible for this:

(trunk_output): Sequential(
    (block1): AnyStage(
      (block1-0): ResBottleneckBlock(
        (proj): Conv2dNormActivation(
          (0): Conv2d(32, 232, kernel_size=(1, 1), stride=(2, 2), bias=False)
          (1): BatchNorm2d(232, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        )

cc @digantdesai @mcr229 @cbilgin

@GregoryComer GregoryComer added module: xnnpack Issues related to xnnpack delegation and the code under backends/xnnpack/ ciflow/nightly labels Sep 17, 2025
Copy link

pytorch-bot bot commented Sep 17, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure, 3 Cancelled Jobs

As of commit 5798adb with merge base cb42db2 (image):

NEW FAILURE - The following job has failed:

CANCELLED JOBS - The following jobs were cancelled. Please retry:

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

@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 Sep 17, 2025
Copy link

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.

@GregoryComer GregoryComer marked this pull request as ready for review September 17, 2025 23:22
Comment on lines +228 to +233
INVALID_CHARS = [".", "-"]

sanitized = name
for c in INVALID_CHARS:
sanitized = sanitized.replace(c, "_")
return sanitized
Copy link
Contributor

Choose a reason for hiding this comment

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

This is more performant

return name.translate(str.maketrans('.-', '__'))

@mergennachin mergennachin added this to the 1.0.0 milestone Sep 18, 2025
@digantdesai
Copy link
Contributor

causes things to blow up

Can you put the error log? I am trying to figure out what's the exact issue..

)
else:
fused_bias_name = (input_node_bias_name + "_fused_bn").replace(".", "_")
fused_bias_name = sanitize_node_name(input_node_bias_name + "_fused_bn")
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we are sensitive to names, we should put assert somewhere downstream where we check not INVALID_CHARS sneaks in..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/nightly CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: xnnpack Issues related to xnnpack delegation and the code under backends/xnnpack/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants