GLM-5.3 · Training

T03 · Packed DP2

Valid

Qwen3-4B CodeOpt packed DP2 training 2dev · Implementation Optimization

1.01×PERFORMANCE RATIO
173TOOL EVENTS
1TEXT PATCHES
0BINARY NAMES

01 / PROCESS MAP

Tool activity

Each row shows one agent’s tool events in its own recorded order. Colors show broad activities; bar widths do not represent duration.

Main agentGLM-5.3 · 173 visible calls

InspectEditValidateExecuteBuildProfileRollbackOther
132Inspect
19Edit
1Build
13Execute
3Profile
1Rollback
4Other

02 / EVENT SEQUENCE

Event timeline

Requests are grouped by agent, activity and topic. Delegations open into child branches. Summaries describe visible requests; tool errors and missing responses are flagged. A recorded response does not establish command success or a performance improvement.

Show event timelineHide event timeline101 groups · 173 calls

Scroll within this panel to view all events. Command sketches retain familiar programs and options. Values become <val> or <n>; paths, addresses and script bodies are hidden as <path>, <url> and <script>.

Main agent

  1. Inspect · Source & workspace

    Requested workspace inspection and file and log inspection related to source & workspace.

    1 call · #0001–#0001

    echo <val>ls -l -a <path> <n> > <path>head -n <n>
  2. Inspect · Task requirements

    Requested file and log inspection related to task requirements.

    2 calls · #0002–#0003

    Read <path>
  3. Inspect · Source & workspace

    Requested workspace inspection and file and log inspection related to source & workspace.

    2 calls · #0004–#0005

    find <path> -type <val>head -n <n>echo <flag>ls -l -a <path>Read <path>
  4. Inspect · Benchmark & validation setup

    Requested file and log inspection related to benchmark & validation setup.

    1 call · #0006–#0006

    Read <path>
  5. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    2 calls · #0007–#0008

    Read <path>
  6. Inspect · Device memory

    Requested runtime inspection, file and log inspection and environment setup or inspection related to device memory.

    1 call · #0009–#0009

    npu-smi info <n> >& <path>head -n <n>echo <flag>envgrep -i -E <val>sort
  7. Inspect · Source & workspace

    Requested workspace inspection, file and log inspection and repository inspection related to source & workspace.

    2 calls · #0010–#0011

    ls -l -a <path> <path> <path> <n> >& <path>head -n <n>echo <flag>cat <path>cd <path>git log --oneline <flag> <args>
    3 more command sketches
    headgit status --shortls
  8. Execute · Benchmark & validation setup

    Requested script or workload execution related to benchmark & validation setup.

    1 call · #0012–#0012

    cd <path>bash <script> > <path> <n> >& <path>echo <val> >> <path>
  9. Inspect · Source & workspace

    Requested file and log inspection and workspace inspection related to source & workspace.

    5 calls · #0013–#0017

    Read <path>ls -R <path> <n> > <path>head -n <n>echo <flag>find <path> -name <val>cd <path>
    2 more command sketches
    sed -n <val> <path>ls <path>
  10. Inspect · Benchmark & validation setup

    Requested file and log inspection and workspace inspection related to benchmark & validation setup.

    1 call · #0018–#0018

    tail -n <n> <path> <n> > <path>ls <path>
  11. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    1 call · #0019–#0019

    sed -n <val> <path>
  12. Execute · Benchmark & validation setup

    Requested file and log inspection related to benchmark & validation setup.

    1 call · #0020–#0020

    tail -c <n> <path> <n> > <path>
  13. Inspect · Benchmark & validation setup

    Requested file and log inspection related to benchmark & validation setup.

    1 call · #0021–#0021

    tail -c <n> <path>
  14. Inspect · Attention kernels

    Requested source searches and file and log inspection related to attention kernels.

    2 calls · #0022–#0023

    grep -n <val> -n <path>head -n <n>sed -n <val> <path>
  15. Inspect · Benchmark & validation setup

    Requested file and log inspection and workspace inspection related to benchmark & validation setup.

    1 call · #0024–#0024

    tail -c <n> <path>echo <val>ls <path>
  16. Inspect · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    5 calls · #0025–#0029

    grep -n <val> <path>head -n <n>grep -r -n <val> <path>headsed -n <val> <path>echo <val>
  17. Inspect · Attention kernels

    Requested source searches and file and log inspection related to attention kernels.

    2 calls · #0030–#0031

    grep -n <val> -A <n> <path>grep -n <val> <path>head -n <n>
  18. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0032–#0032

    sed -n <val> <path>
  19. Inspect · Attention kernels

    Requested source searches and file and log inspection related to attention kernels.

    2 calls · #0033–#0034

    grep -n <val> <path>head -n <n>sed -n <val> <path>
  20. Inspect · Benchmark & validation setup

    Requested file and log inspection and workspace inspection related to benchmark & validation setup.

    1 call · #0035–#0035

    tail -c <n> <path>echo <val>ls -t <path>head
  21. Inspect · Attention kernels

    Requested workspace inspection, file and log inspection and source searches related to attention kernels.

    4 calls · #0036–#0039

    find <path> -name <val>echo <flag>cat <path> <n> > <path>head -n <n>sed -n <val> <path>grep -r -n <val> <path> <path>
    1 more command sketches
    echo <val>
  22. Inspect · Benchmark & validation setup

    Requested source searches, file and log inspection and workspace inspection related to benchmark & validation setup.

    1 call · #0040–#0040

    grep -a <val> <path>tail -n <n>echo <val>ls -t <path>head -n <n>
  23. Inspect · Attention kernels

    Requested source searches and file and log inspection related to attention kernels.

    3 calls · #0041–#0043

    grep -r -n <val> <path> <path>head -n <n>sed -n <val> <path>echo <val>grep -n <val> <path>
  24. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0044–#0044

    sed -n <val> <path>
  25. Inspect · Benchmark & validation setup

    Requested source searches and file and log inspection related to benchmark & validation setup.

    1 call · #0045–#0045

    grep -a <val> <path>tail -n <n>
  26. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    5 calls · #0046–#0050

    cat <path>head -n <n>sed -n <val> <path>grep -r -n <val> -A <n> <path>grep -r -n <val> -A <n> <path> <path>grep -r -n <val> <path> <n> > <path>
    1 more command sketches
    grep -v <val>
  27. Build · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    1 call · #0051–#0051

    grep -r -n <val> <path> <n> > <path>grep -v <val>head -n <n>echo <val>grep -r -n <val> -A <n> <path> <n> > <path>
  28. Inspect · Source & workspace

    Requested workspace inspection, source searches and file and log inspection related to source & workspace.

    2 calls · #0052–#0053

    ls <path>echo <val>grep -r -n <val> <path>headgrep -r -n <val> -A <n> <path>head -n <n>
  29. Inspect · Benchmark & validation setup

    Requested source searches and file and log inspection related to benchmark & validation setup.

    1 call · #0054–#0054

    grep -a <val> <path>tail -n <n>
  30. Inspect · Attention kernels

    1 tool error

    Requested workspace inspection, file and log inspection and source searches related to attention kernels.

    2 calls · #0055–#0056

    ls <path>echo <val>sed -n <val> <path> <n> > <path>grep -r -n <val> <path>grep -v <val>head -n <n>
  31. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0057–#0057

    cat <path>echo <val>sed -n <val> <path>
  32. Execute · Benchmark & validation setup

    Requested file and log inspection, workspace inspection and source searches related to benchmark & validation setup.

    1 call · #0058–#0058

    tail -n <n> <path>ls -t <path>head -n <n>grep -a <val> <path> <n> > <path>tail -n <n>
  33. Inspect · Benchmark & validation setup

    Requested execution waits and file and log inspection related to benchmark & validation setup.

    1 call · #0059–#0059

    sleep <n>tail -n <n> <path>
  34. Inspect · Optimizer & gradients

    Requested source searches and file and log inspection related to optimizer & gradients.

    1 call · #0060–#0060

    grep -n <val> <path>head -n <n>
  35. Execute · Benchmark & validation setup

    Requested file and log inspection, script or workload execution and source searches related to benchmark & validation setup.

    2 calls · #0061–#0062

    tail -n <n> <path>echo <flag>python3 -c <script>grep -a <val> <path> <n> > <path>tail -n <n>echo
    1 more command sketches
    tail -c <n> <path> <n> > <path>
  36. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    4 calls · #0063–#0066

    sed -n <val> <path>grep -n <val> -A <n> <path>head -n <n>grep -r -n <val> <path> <path>head
  37. Inspect · Benchmark & validation setup

    Requested file and log inspection, workspace inspection and execution waits related to benchmark & validation setup.

    2 calls · #0067–#0068

    tail -c <n> <path>ls -t <path>head -n <n>sleep <n>
  38. Execute · Benchmark & validation setup

    Requested script or workload execution related to benchmark & validation setup.

    1 call · #0069–#0069

    cd <path>python3 -c <script>
  39. Inspect · Benchmark & validation setup

    Requested file and log inspection related to benchmark & validation setup.

    1 call · #0070–#0070

    tail -n <n> <path>
  40. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    2 calls · #0071–#0072

    sed -n <val> <path>
  41. Execute · Benchmark & validation setup

    Requested script or workload execution and file and log inspection related to benchmark & validation setup.

    1 call · #0073–#0073

    cd <path>python3 -c <script>head -n <n>
  42. Edit · Source & workspace

    Requested code edits related to source & workspace.

    2 calls · #0074–#0075

    Write <path>Edit <path>
  43. Inspect · Source & workspace

    Requested environment setup or inspection and file and log inspection related to source & workspace.

    4 calls · #0076–#0079

    cd <path>env <vars> bash <script> <n> >& <path>tail -n <n>tail -n <n> <path>head -n <n> <path>sed -n <val> <path>
  44. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0080–#0080

    Edit <path>
  45. Inspect · Source & workspace

    Requested environment setup or inspection, file and log inspection and source searches related to source & workspace.

    2 calls · #0081–#0082

    cd <path>env <vars> bash <script> <n> >& <path>tail -n <n>grep -a -E <val> <path>
  46. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0083–#0083

    Edit <path>
  47. Inspect · Source & workspace

    Requested script or workload execution, file and log inspection and source searches related to source & workspace.

    1 call · #0084–#0084

    cd <path><command> <args>bash <script> > <path> <n> >& <path>echo <val> <val> <val>tail -n <n>grep -a <val> <path>
  48. Inspect · Runtime processes

    Requested environment setup or inspection, execution waits and process termination related to runtime processes.

    1 call · #0085–#0085

    cd <path>env <vars> bash <script> > <path> <n> >& <path>env <vars><command> <args>echo <val>sleep <n>
    5 more command sketches
    wait <val>kill <val> <n> > <path>tail -n <n> <path>grep -a <val> <path>tail -n <n>
  49. Inspect · Source & workspace

    Requested environment setup or inspection, execution waits and runtime inspection related to source & workspace.

    2 calls · #0086–#0087

    cd <path>env <vars> bash <script> > <path> <n> >& <path>env <vars>sleep <n><command> <args>echo <flag>
    10 more command sketches
    ps <flag> <args>grep -a <val>grep -v <val>cut <flag>wait <val>echo <val>grep -a <val> <path>grep -n <val> <flag> <args>awk <path> <path>head -n <n>
  50. Inspect · Runtime processes

    Requested environment setup or inspection, execution waits and source searches related to runtime processes.

    2 calls · #0088–#0089

    cd <path>env <vars> bash <script> > <path> <n> >& <path>env <vars>sleep <n><command> <args>echo <flag>
    6 more command sketches
    tr <val> <val>echo <val>wait <val>grep -a <val> <path>awk <path> <path>head -n <n>
  51. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0090–#0090

    sed -n <val> <path>
  52. Edit · Source & workspace

    Requested code edits related to source & workspace.

    2 calls · #0091–#0092

    Edit <path>
  53. Inspect · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    1 call · #0093–#0093

    grep -n <val> <path>head -n <n>
  54. Profile · Source & workspace

    Requested environment setup or inspection, file and log inspection and workspace inspection related to source & workspace.

    1 call · #0094–#0094

    cd <path>env <vars> bash <script> > <path> <n> >& <path>tail -n <n> <path>ls -l -a <path> <n> > <path>
  55. Inspect · Source & workspace

    1 tool error

    Requested source searches, file and log inspection and workspace inspection related to source & workspace.

    4 calls · #0095–#0098

    grep -a <val> <path> <path>head -n <n>grep -a <val> <path>wc -lls -l -a <path>python3 - <script>
    3 more command sketches
    grep -n <val> -A <n> <path>grep -r -n <val> <path> <path>head
  56. Edit · Source & workspace

    Requested code edits related to source & workspace.

    2 calls · #0099–#0100

    Edit <path>
  57. Inspect · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    1 call · #0101–#0101

    grep -n <val> <path>head -n <n>
  58. Inspect · Optimizer & gradients

    Requested environment setup or inspection, source searches and file and log inspection related to optimizer & gradients.

    1 call · #0102–#0102

    cd <path>env <vars> bash <script> > <path> <n> >& <path>grep -a <val> <path>head -n <n>
  59. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0103–#0103

    sed -n <val> <path>
  60. Inspect · Runtime processes

    Requested file and log inspection related to runtime processes.

    1 call · #0104–#0104

    sed -n <val> <path>
  61. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    2 calls · #0105–#0106

    sed -n <val> <path>echo <val>grep -r -n <val> -A <n> <path>head -n <n>grep -r -n <val> <path> <path> <n> > <path>head
    1 more command sketches
    echo <flag>
  62. Inspect · Parallelism & communication

    Requested file and log inspection and source searches related to parallelism & communication.

    2 calls · #0107–#0108

    sed -n <val> <path>echo <val>grep -n <val> -A <n> <path>tail -n <n>
  63. Edit · Source & workspace

    Requested code edits related to source & workspace.

    3 calls · #0109–#0111

    Edit <path>
  64. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    1 call · #0112–#0112

    cd <path>head -n <n> <path>grep -n <val>head -n <n>
  65. Other · Source & workspace

    Requested script or workload execution and file and log inspection related to source & workspace.

    1 call · #0113–#0113

    cd <path>python3 - <script>head -n <n> <path>
  66. Inspect · Source & workspace

    Requested environment setup or inspection, source searches and file and log inspection related to source & workspace.

    3 calls · #0114–#0116

    cd <path>env <vars> bash <script> > <path> <n> >& <path>grep -a <val> <path>tail -n <n>grep -r -n <val> <path> <path> <n> > <path>grep -v <val>
    1 more command sketches
    head -n <n>
  67. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    4 calls · #0117–#0120

    sed -n <val> <path>echo <path>cat <path>
  68. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0121–#0121

    Edit <path>
  69. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    1 call · #0122–#0122

    Read <path>
  70. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0123–#0123

    Edit <path>
  71. Inspect · Attention kernels

    Requested file and log inspection and source searches related to attention kernels.

    1 call · #0124–#0124

    head -n <n> <path>grep -n <val>
  72. Other · Attention kernels

    Requested script or workload execution and file and log inspection related to attention kernels.

    1 call · #0125–#0125

    python3 - <script>head -n <n> <path>
  73. Inspect · Attention kernels

    Requested environment setup or inspection, source searches and file and log inspection related to attention kernels.

    4 calls · #0126–#0129

    cd <path>env <vars> bash <script> > <path> <n> >& <path>grep -a <val> <path>tail -n <n>head -n <n>echo <path>
    5 more command sketches
    grep <flag> <args>ls <path> <n> > <path>cat <path> <n> > <path>grep -n <val> <path>cat <path>
  74. Inspect · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    1 call · #0130–#0130

    grep -r -n <val> <path> <path> <n> > <path>head -n <n>echo <val>grep -r -n <val> -A <n> <path> <path> <n> > <path>grep -v <val>
  75. Inspect · Parallelism & communication

    Requested file and log inspection, environment setup or inspection and source searches related to parallelism & communication.

    3 calls · #0131–#0133

    cat > <path> <script>cd <path><command> <args>env <vars> python3 -m <module> --nproc_per_node <n> --nnodes <n> --master_addr <val> --master_port <n> <args>echo <val>grep -a <val> <path>
    2 more command sketches
    grep <val>tail -n <n>
  76. Inspect · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    1 call · #0134–#0134

    grep -a <val> <path>tail -n <n>echo <val>cat <path>grep -i <val>head -n <n>
  77. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0135–#0135

    Edit <path>
  78. Inspect · Source & workspace

    Requested script or workload execution, source searches and file and log inspection related to source & workspace.

    1 call · #0136–#0136

    cd <path><command> <args>bash <script> > <path> <n> >& <path>echo <val>grep -a <val> <path>tail -n <n>
    1 more command sketches
    cut <flag>
  79. Profile · Parallelism & communication

    Requested file and log inspection, environment setup or inspection and source searches related to parallelism & communication.

    1 call · #0137–#0137

    cat > <path> <script>cd <path><command> <args>env <vars> python3 -m <module> --nproc_per_node <n> --nnodes <n> --master_addr <val> --master_port <n> <args>echo <val>grep -a <val> <path>
    1 more command sketches
    tail -n <n>
  80. Inspect · Device memory

    Requested source searches and file and log inspection related to device memory.

    1 call · #0138–#0138

    grep -a <val> <path>tail -n <n>echo <flag>grep -i <val> <path>head -n <n>
  81. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0139–#0139

    datedate -uecho <val>python3 -c <script>
  82. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0140–#0140

    Edit <path>
  83. Inspect · Source & workspace

    Requested script or workload execution and source searches related to source & workspace.

    1 call · #0141–#0141

    cd <path><command> <args>bash <script> > <path> <n> >& <path>echo <val>grep -a <val> <path>
  84. Other · Runtime processes

    Requested script or workload execution related to runtime processes.

    1 call · #0142–#0142

    cd <path>python3 - <script>
  85. Inspect · Attention kernels

    Requested script or workload execution, environment setup or inspection and source searches related to attention kernels.

    1 call · #0143–#0143

    cd <path>python3 - <script>env <vars> bash <script> > <path> <n> >& <path>grep -a <val> <path>tail -n <n>
  86. Inspect · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    2 calls · #0144–#0145

    grep -a <val> <path>tail -n <n>echo <val>tail -n <n> <path>grep -a <flag> <args>head -n <n>
  87. Rollback · Attention kernels

    Requested source restoration, repository inspection and source searches related to attention kernels.

    1 call · #0146–#0146

    git checkout <flag> <args>git status --shortcd <path>echo <val>grep -c <val> <path> <path> <path> <path> <path> <path> <path>
  88. Inspect · Parallelism & communication

    Requested workspace file updates, source searches and file and log inspection related to parallelism & communication.

    1 call · #0147–#0147

    rm -rf <path>cd <path>grep -r -n <val> <path> <path>head -n <n>echo <val>grep -n <val> -A <n> <path>
  89. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    4 calls · #0148–#0151

    cd <path>sed -n <val> <path>echo <val>grep -r -n <val> <path> <path> <n> > <path>head -n <n>grep -r -n <val> --include <path> <path>
    2 more command sketches
    grep -v <val>cat <path>
  90. Inspect · Attention kernels

    1 tool error

    Requested file and log inspection, workspace inspection and source searches related to attention kernels.

    6 calls · #0152–#0157

    sed -n <val> <path>find <path> -path <path>headecho <flag>find <path> -name <path>cd <path>
    5 more command sketches
    tail -n <n> <path>echo <val>grep -n <val> -B <n> <path>head -n <n>grep -n <val> -A <n> <path>
  91. Edit · Attention kernels

    1 tool error

    Requested code edits related to attention kernels.

    3 calls · #0158–#0160

    Edit <path>
  92. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    1 call · #0161–#0161

    cd <path>sed -n <val> <path>cat -Ahead -n <n>
  93. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0162–#0162

    Edit <path>
  94. Execute · Benchmark & validation setup

    Requested script or workload execution, file and log inspection and execution waits related to benchmark & validation setup.

    2 calls · #0163–#0164

    cd <path>timeout <n> <val> <path> > <path> <n> >& <path>echo <val> >> <path>tail -c <n> <path>sleep <n>ls -t <path>
    4 more command sketches
    head -n <n>grep -a <val> <path> <n> > <path>tail -n <n>cut <flag>
  95. Inspect · Attention kernels

    Requested script or workload execution and repository inspection related to attention kernels.

    1 call · #0165–#0165

    cd <path>python3 -m <module> <script>echo <val>git diff --stat
  96. Execute · Benchmark & validation setup

    1 tool error

    Requested execution waits, workspace inspection and file and log inspection related to benchmark & validation setup.

    2 calls · #0166–#0167

    sleep <n>ls -t <path>head -n <n>grep -a <val> <path> <n> > <path>tail -n <n>cut <flag>
  97. Inspect · Benchmark & validation setup

    Requested source searches and file and log inspection related to benchmark & validation setup.

    1 call · #0168–#0168

    grep -a <val> <path>sed <path>tail -n <n>
  98. Execute · Benchmark & validation setup

    Requested execution waits, file and log inspection and script or workload execution related to benchmark & validation setup.

    2 calls · #0169–#0170

    sleep <n>tail -c <n> <path>python3 -c <script>stat -c <val> <path>datepython3 -c <script> <n> >& <path>
    1 more command sketches
    tail -n <n>
  99. Inspect · Source & workspace

    Requested repository inspection related to source & workspace.

    1 call · #0171–#0171

    git status --shortecho <flag>cd <path>git diff
  100. Profile · Runtime processes

    Requested workspace file updates, repository inspection and runtime inspection related to runtime processes.

    1 call · #0172–#0172

    rm -rf <path>cd <path>git status --shortpgrep -f <path>head -n <n>echo <val>
  101. Inspect · Device memory

    Requested runtime inspection, execution waits and file and log inspection related to device memory.

    1 call · #0173–#0173

    ps -o <val> -p <n> <flag> <args>cut <flag>sleep <n>pgrep -f <path>head -n <n>echo <flag>
    2 more command sketches
    npu-smi info <n> > <path>tail -n <n>

03 / CANDIDATE ARTIFACT

Text patches & binary names

Read code changes as Git diffs. Identifying strings are masked; binary files are listed by their full relative names.

mindspeed_llm · 1 changed files

Base commit: 72c49a6260c73669678b8f39b1ba41a4789bb555

diff --git a/mindspeed_llm/core/models/common/embeddings/rotary_pos_embedding.py b/mindspeed_llm/core/models/common/embeddings/rotary_pos_embedding.pyindex bd2b975cb13f4d801c4b7668fb4c4e0e22d3b015..d6c7e1bb130705110e9c521c84ba12ec68ad1b93 100644--- a/mindspeed_llm/core/models/common/embeddings/rotary_pos_embedding.py+++ b/mindspeed_llm/core/models/common/embeddings/rotary_pos_embedding.py@@ -222,6 +222,29 @@ def apply_rotary_pos_emb(t, freqs, rotary_interleaved=False):     return torch.cat((t, t_pass), dim=-1)  +_ROPE_COS_SIN_CACHE = {}+++def _rope_cos_sin(freqs: Tensor, mscale: float, dtype: torch.dtype):+    """Evaluate the RoPE cos/sin tables for ``freqs``.++    The frequency table only depends on the sequence layout of the micro-batch,+    so every transformer layer of a micro-batch feeds the exact same table in.+    Caching it keeps the trigonometry (two kernels plus two casts) from being+    re-run twice per layer. The cached entry keeps a reference to ``freqs`` so+    its address cannot be recycled while the entry is alive.+    """+    key = (freqs.data_ptr(), tuple(freqs.shape), freqs.dtype, freqs.get_device(),+           float(mscale), dtype)+    entry = _ROPE_COS_SIN_CACHE.get("entry")+    if entry is not None and entry[0] == key:+        return entry[1], entry[2]+    cos_ = (torch.cos(freqs) * mscale).to(dtype)+    sin_ = (torch.sin(freqs) * mscale).to(dtype)+    _ROPE_COS_SIN_CACHE["entry"] = (key, cos_, sin_, freqs)+    return cos_, sin_++ def apply_rotary_pos_emb_bshd(     t: Tensor,     freqs: Tensor,@@ -255,9 +278,7 @@ def apply_rotary_pos_emb_bshd(         *dims, d = t.shape         t = t.reshape(*dims, d // 2, 2).transpose(-2, -1).reshape(*dims, d) -    cos_ = (torch.cos(freqs) * _mscale).to(t.dtype)-    sin_ = (torch.sin(freqs) * _mscale).to(t.dtype)-    +    cos_, sin_ = _rope_cos_sin(freqs, _mscale, t.dtype)     if args.use_fused_rotary_pos_emb:         mode = 1 if rotary_interleaved else 0         t = npu_rotary_position_embedding(t.contiguous(), cos_, sin_, mode).to(t.dtype)