Skip to content

[SOT] Add dynamic shape test when UNSAFE_CACHE_FASTPATH=1 #73519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

DrRyanHuang
Copy link
Contributor

@DrRyanHuang DrRyanHuang commented Jun 21, 2025

PR Category

Execute Infrastructure

PR Types

Improvements

Description

#73372 中没有覆盖动态shape相关的单测,此处添加,同时覆盖 #73506#73511 的情况
PCard-66972

Copy link

paddle-bot bot commented Jun 21, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

for _ in range(33):
# The test needs to consider the issue of dynamic shapes: when the input shape changes,
# the previous cache may become invalid.
self.assert_results(add, 1, paddle.ones([32, 4]))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

加上这一行之后,由于已经将命中的 cache 提前了,和下面👇🏻guard_tree 的结果对不上了

======================================================================
FAIL: test_guard (__main__.TestUnsafeCacheFastPath)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/executor_cache.py", line 258, in lookup
    cache_index is None or index == cache_index
AssertionError: cache_index(1) is not equal to index(0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/workspace/paddle/test/sot/test_guard_fastpath_strategy.py", line 61, in test_guard
    self.assert_results(add, 1, paddle.ones([4]))
  File "/workspace/paddle/test/sot/test_case_base.py", line 71, in assert_results
    sym_output = symbolic_translate(func)(*args, **kwargs)
  File "/workspace/paddle/build/python/paddle/jit/sot/translate.py", line 106, in impl
    raise e
  File "/workspace/paddle/build/python/paddle/jit/sot/translate.py", line 104, in impl
    outs = fn(*args, **kwargs)
  File "/workspace/paddle/build/python/paddle/jit/sot/translate.py", line 94, in callback
    return eval_frame_callback(frame, **kwargs)
  File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/eval_frame_callback.py", line 75, in eval_frame_callback
    custom_code = OpcodeExecutorCache()(frame, **kwargs)
  File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/executor_cache.py", line 140, in __call__
    return self.lookup(
  File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/executor_cache.py", line 300, in lookup
    assert type(e) == type(mirror_guard_error) and str(
AssertionError: mirror guard error is not equal to guard error, guard_error: cache_index(1) is not equal to index(0) 
mirror_guard_error: None,

这部分对不上了:

    assert (
        cache_index is None or index == cache_index
    ), f"cache_index({cache_index}) is not equal to index({index})"

cc @SigureMo

Copy link
Member

Choose a reason for hiding this comment

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

可以局部关掉 SOT_ENABLE_STRICT_GUARD_CHECK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants