Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Conversation

yanboliang
Copy link
Contributor

@yanboliang yanboliang commented May 13, 2022

This is to resubmit #222.
Fix #231, now ./torchbench.py -k yolov3 works well.

  • Root cause: ConstantVariable.call_method wraps value as TupleVariable and call its call_method, but doesn't propagate source info in this conversion, so the source chain is missed when codegen.
  • Why torchbench doesn't fail before Fix slicing list returning wrong result #222?
    • Because it falls into another branch here previously. Actually I think we can switch the order to first check python constant:
if value.is_python_constant() and is_safe_constant(
   value.as_python_constant()
):
   output.append(self.create_load_const(value.as_python_constant()))
elif value.source is not None and allow_cache:
   output.extend(value.source.reconstruct(self))

As this can generate more concise code if the stack value is python constant compatible(only LOAD CONST in this case, and doesn't need to trace the source). I'd like to know if this is aligned with the design philosophy and update this PR if it makes sense.

@yanboliang yanboliang merged commit a96f9ad into pytorch:main May 13, 2022
@yanboliang yanboliang deleted the slice2 branch May 13, 2022 17:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants