Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8183250
Experimentally specialize BINARY_OP by refcount
markshannon Mar 27, 2024
198ceb6
Get better type information for stats on binary ops
markshannon Apr 3, 2024
3b3c8ce
Specialize binary op by refcount and type
markshannon Apr 3, 2024
7eefd3e
Merge branch 'main' into specialize-binary-op-refcount
markshannon Apr 4, 2024
4baa860
Use the right version numbers
markshannon Apr 4, 2024
24d57df
Gather better stats
markshannon Apr 4, 2024
accc60a
Add percentages to summary
markshannon Apr 4, 2024
23cf5de
Fix stats again
markshannon Apr 4, 2024
daa2733
Handle errors
markshannon Apr 4, 2024
67bbc52
Improve BINARY_OP specializations
markshannon Apr 5, 2024
2c964fa
Add back BINARY_OP_INPLACE_ADD_UNICODE and fix up dis test
markshannon Apr 5, 2024
4c084f8
Add more BINARY_OP specializations
markshannon Apr 6, 2024
cd8bea7
Add back BINARY_OP_INPLACE_ADD_UNICODE specialization
markshannon Apr 6, 2024
627f373
Merge branch 'main' into specialize-binary-op-refcount
markshannon Apr 8, 2024
a964a49
Restore BINARY_OP_INPLACE_ADD_UNICODE uop code.
markshannon Apr 8, 2024
11ac97f
Fix up test_dis again
markshannon Apr 8, 2024
2d3fa14
Mostly fix test_capi.test_opt
markshannon Apr 8, 2024
a327a4c
Perform tier 2 optimization on type version guards
markshannon Apr 8, 2024
a14d631
Explain _BINARY_OP_TABLE suffixes
markshannon Apr 8, 2024
ffbc9e7
Export symbol for JIT
markshannon Apr 9, 2024
d9acedb
Make things const
markshannon Apr 9, 2024
dc7092b
Merge branch 'main' into specialize-binary-op-refcount
markshannon May 21, 2024
48e287c
Add news
markshannon May 21, 2024
8708306
Merge branch 'main' into specialize-binary-op-refcount
markshannon May 22, 2024
8b4a480
Fix test_dis
markshannon May 22, 2024
28c384c
Restore constant propagation in binary op optimizer
markshannon May 23, 2024
881df50
Workaround false positive in check-c-globals.py
markshannon May 23, 2024
5386b2d
Merge branch 'main' into specialize-binary-op-refcount
markshannon May 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix stats again
  • Loading branch information
markshannon committed Apr 4, 2024
commit 23cf5dee5910fd9a37e837218716a61fbb749347
8 changes: 5 additions & 3 deletions Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ print_stats(FILE *out, PyStats *stats)
print_gc_stats(out, stats->gc_stats);
print_optimization_stats(out, &stats->optimization_stats);
print_rare_event_stats(out, &stats->rare_event_stats);
for (int i = 0; i < (1<<13); i++) {
for (int i = 0; i < (1<<15); i++) {
if (stats->binary_specialization_failure[i]) {
fprintf(out, "Binary specialization failure[%d]: %" PRIu64 "\n", i, stats->binary_specialization_failure[i]);
}
Expand Down Expand Up @@ -417,7 +417,7 @@ do { \

#ifndef SPECIALIZATION_FAIL
# define SPECIALIZATION_FAIL(opcode, kind) ((void)0)
# define BINARY_SPECIALIZATION_FAIL(lhs, rhs, kind, oparg) ((void)0)
# define BINARY_SPECIALIZATION_FAIL(lv, rv, kind, oparg) ((void)0)
#endif

// Initialize warmup counters and insert superinstructions. This cannot fail.
Expand Down Expand Up @@ -2090,7 +2090,9 @@ binary_specialization_fail(int lv, int rv, int kind, int oparg)
}
assert(kind < 4);
assert(oparg < 32);
_Py_stats->binary_specialization_failure[(oparg << 10) | (kind << 8) | (lv << 4) | rv]++;
int hash = (oparg << 10) | (kind << 8) | (lv << 4) | rv;
assert(hash < (1 << 15));
_Py_stats->binary_specialization_failure[hash]++;
}
#endif // Py_STATS

Expand Down