[SOT][3.14] support `LOAD_SMALL_INT` op code by gouzil · Pull Request #76257 · PaddlePaddle/Paddle

@gouzil

PR Category

Execute Infrastructure

PR Types

Performance

Description

支持 LOAD_SMALL_INT 字节码

新通过的单测

  • test_02_store_inplace.py
  • test_08_rot.py
  • test_09_f_string.py
  • test_16_paddle_api.py
  • test_20_string.py
  • test_call_ast.py
  • test_call_object.py
  • test_dup_top.py
  • test_execution_base.py
  • test_guard_user_defined_fn.py
  • test_instruction_translator_cache.py
  • test_no_grad.py
  • test_output_restoration.py
  • test_pure_class.py
  • test_sot_place.py
  • test_symbolic_operation.py
  • test_user_specified_dynamic_dims.py

剩余单测 55

@gouzil

@paddle-bot

你的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.

SigureMo

Choose a reason for hiding this comment

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

LGTMeow 🐾

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for the LOAD_SMALL_INT opcode, which was introduced in Python 3.14. This opcode optimizes loading small integer constants by providing a more efficient alternative to LOAD_CONST for frequently used small integers.

  • Implements LOAD_SMALL_INT opcode handler that wraps integer values as constant variables

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +999 to +1002

def LOAD_SMALL_INT(self, instr: Instruction):
int_value = instr.argval
int_var = ConstantVariable.wrap_literal(int_value, self._graph)
self.stack.push(int_var)

Choose a reason for hiding this comment

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

The LOAD_SMALL_INT function is placed before the '# 3.14 opcodes' comment at line 1004, but it is itself a Python 3.14 opcode. For better code organization and consistency, this function should be moved after the comment to group it with other 3.14 opcodes (LOAD_FAST_BORROW, NOT_TAKEN, POP_ITER).

Copilot uses AI. Check for mistakes.

@codecov-commenter

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@6cab4e7). Learn more about missing BASE report.

Files with missing lines Patch % Lines
.../sot/opcode_translator/executor/opcode_executor.py 25.00% 3 Missing ⚠️

❌ Your patch status has failed because the patch coverage (25.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #76257   +/-   ##
==========================================
  Coverage           ?   25.00%           
==========================================
  Files              ?        1           
  Lines              ?        4           
  Branches           ?        0           
==========================================
  Hits               ?        1           
  Misses             ?        3           
  Partials           ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

AlAuAu pushed a commit to AlAuAu/Paddle that referenced this pull request

Nov 6, 2025

Manfredss pushed a commit to Manfredss/PaddleDebug that referenced this pull request

Nov 7, 2025

@gouzil gouzil deleted the sot/support_LOAD_SMALL_INT branch

February 25, 2026 07:49