You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that Thunder JIT currently assumes that attribute accesses always return the same object. It's true only for @functools.cached_property, if a class method is decorated with @property it should be treated as a method call.
File~/dev/lightning-thunder/thunder/core/interpreter.py:6164, in_call_dispatch(compilectx, runtimectx, fn, *args, **kwargs)
6162iflookaside_fn:
6163runtimectx.record_lookaside(lookaside_fn)
->6164res=lookaside_fn(*args, **kwargs)
6165returnres6167# TODO: disabled as partial is just like any other class6168# (3) Handles partial objectsFile~/dev/lightning-thunder/thunder/core/jit_ext.py:732, in_general_jit_getattr_lookaside(obj, name, *maybe_default)
729getattr_lookaside=default_lookaside(getattr)
730assertgetattr_lookasideisnotNone-->732value=getattr_lookaside(obj, name, *maybe_default)
733ifvalueisINTERPRETER_SIGNALS.EXCEPTION_RAISED:
734returnvalueFile~/dev/lightning-thunder/thunder/core/interpreter.py:1678, in_getattr_lookaside(obj, name, *maybe_default)
1676ifresultisnotINTERPRETER_SIGNALS.EXCEPTION_RAISEDornotisinstance(ctx.curexc, AttributeError):
1677ifresultisnotINTERPRETER_SIGNALS.EXCEPTION_RAISEDandcompilectx._with_provenance_tracking:
->1678result=wrap_attribute(result, obj, name)
1679returnresult1681# `__getattr__` is only triggered if `__getattribute__` fails.1682# TODO: this should be `_interpret_call_with_unwrapping(getattr, obj, "__getattr__", null := object())`, but that would require multiple current exceptions.File~/dev/lightning-thunder/thunder/core/interpreter.py:1632, inwrap_attribute(plain_result, obj, name)
1629# note: there are cases where "is" will always fail (e.g. BuiltinMethods1630# are recreated every time)1631ifknown_wrapperisnotNone:
->1632assertplausibly_wrapper_of(
1633known_wrapper, plain_result1634 ), f"attribute {name.value} of {type(obj.value).__name__} object out of sync: {known_wrapper.value} vs. {plain_result}"1635returnknown_wrapper1637pr=ProvenanceRecord(PseudoInst.LOAD_ATTR, inputs=[obj.provenance, name.provenance])
AssertionError: attributetestofTestobjectoutofsync: <objectobjectat0x7f412657f850>vs. <objectobjectat0x7f412657f960>
🐛 Bug
It seems that Thunder JIT currently assumes that attribute accesses always return the same object. It's true only for
@functools.cached_property
, if a class method is decorated with@property
it should be treated as a method call.traceback:
cc @apaz-cli
The text was updated successfully, but these errors were encountered: