GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-114058: Foundations of the Tier2 redundancy eliminator by Fidget-Spinner · Pull Request #115085 · python/cpython

gh-114058: Foundations of the Tier2 redundancy eliminator #115085

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.

Sign up for GitHub

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

Merged
Fidget-Spinner merged 54 commits into python:main from Fidget-Spinner:tier2_redundancy_eliminator
Feb 13, 2024

Uh oh!

There was an error while loading. Please reload this page.

Merged

gh-114058: Foundations of the Tier2 redundancy eliminator #115085

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
169e08d
bring over changes from old branch
Fidget-Spinner Feb 6, 2024
e270364
Port over to Mark's DSL
Fidget-Spinner Feb 6, 2024
e8a8b78
reduce diff
Fidget-Spinner Feb 6, 2024
bb6137a
fix passthrough
Fidget-Spinner Feb 6, 2024
9b15f9e
fix tests
Fidget-Spinner Feb 6, 2024
66bfce5
fix mypy issues
Fidget-Spinner Feb 6, 2024
3789cd9
fix tests and address review
Fidget-Spinner Feb 6, 2024
20d087b
add tests for abstract cases generator
Fidget-Spinner Feb 6, 2024
0f58526
patchcheck
Fidget-Spinner Feb 6, 2024
c55ba14
Address review
Fidget-Spinner Feb 7, 2024
e34a0f5
reduce diff, add tests
Fidget-Spinner Feb 7, 2024
229aab0
fix compilation problems
Fidget-Spinner Feb 7, 2024
3c8def4
don't needlessly clear aliasing information
Fidget-Spinner Feb 7, 2024
649b0c7
remove is_const for now
Fidget-Spinner Feb 7, 2024
2805755
remove type prop (address review)
Fidget-Spinner Feb 7, 2024
54e2f64
Add back SELF_OR_NULL :(
Fidget-Spinner Feb 7, 2024
dcddb2d
remove broken tests
Fidget-Spinner Feb 7, 2024
6e5ed12
address most reviews (except LOAD_ATTR todo)
Fidget-Spinner Feb 8, 2024
a8b27fc
implement NOT_NULL for attributes
Fidget-Spinner Feb 8, 2024
e00ec6f
revert function version cache size
Fidget-Spinner Feb 8, 2024
b8f0af1
remove unused stats
Fidget-Spinner Feb 8, 2024
9a9033f
remove unused macro
Fidget-Spinner Feb 8, 2024
710f609
remove unused types
Fidget-Spinner Feb 8, 2024
eaeb293
remove unused import
Fidget-Spinner Feb 8, 2024
0bb9539
rename file to tier2_redundancy_eliminator
Fidget-Spinner Feb 8, 2024
82405fa
fix the type system
Fidget-Spinner Feb 8, 2024
2e31906
fix cases generator
Fidget-Spinner Feb 8, 2024
ed25ce0
remove whitespace
Fidget-Spinner Feb 8, 2024
3bf3c7d
check all overridden uops are originally defined
Fidget-Spinner Feb 8, 2024
2af5b74
error -> out of space
Fidget-Spinner Feb 8, 2024
cb1d5fe
fix test cases
Fidget-Spinner Feb 8, 2024
5013027
remove extra lines
Fidget-Spinner Feb 8, 2024
1283660
fix out_of_space vs error
Fidget-Spinner Feb 8, 2024
d14dac6
fix CI
Fidget-Spinner Feb 8, 2024
5394cdd
move macros out, remove temp writebuffer
Fidget-Spinner Feb 9, 2024
0729778
update comment
Fidget-Spinner Feb 10, 2024
35227f8
Address review
Fidget-Spinner Feb 12, 2024
40a19f7
set IS_NULL as a flag
Fidget-Spinner Feb 12, 2024
0a4b6be
Merge remote-tracking branch 'upstream/main' into tier2_redundancy_el…
Fidget-Spinner Feb 12, 2024
aaeb4cd
Fix a bug
Fidget-Spinner Feb 12, 2024
6143256
fix a bug in frames
Fidget-Spinner Feb 12, 2024
35fff8f
address review
Fidget-Spinner Feb 12, 2024
2b6eff4
remove sym sharing
Fidget-Spinner Feb 12, 2024
3b5b498
Address changes
Fidget-Spinner Feb 12, 2024
702a6fc
Address review
Fidget-Spinner Feb 12, 2024
77e56ff
address review
Fidget-Spinner Feb 13, 2024
c457098
Merge remote-tracking branch 'upstream/main' into tier2_redundancy_el…
Fidget-Spinner Feb 13, 2024
fcd31af
rename inst -> this_instr
Fidget-Spinner Feb 13, 2024
92b211c
address review
Fidget-Spinner Feb 13, 2024
1bf6ef8
remove whitespace
Fidget-Spinner Feb 13, 2024
ea3755f
remove assert
Fidget-Spinner Feb 13, 2024
f09e3c3
remove enabled
Fidget-Spinner Feb 13, 2024
9670b23
fix up error codes
Fidget-Spinner Feb 13, 2024
38420c3
fix error code again
Fidget-Spinner Feb 13, 2024
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
rename inst -> this_instr
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@Fidget-Spinner
Fidget-Spinner committed Feb 13, 2024
commit fcd31aff78d14fec70d150893416ef86aed77050

There are no files selected for viewing

10 changes: 5 additions & 5 deletions 10 Python/optimizer_analysis.c
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -608,12 +608,12 @@ uop_redundancy_eliminator(
goto error;
}

for (_PyUOpInstruction *inst = trace;
inst < trace + trace_len && !op_is_end(inst->opcode);
inst++) {
for (_PyUOpInstruction *this_instr = trace;
this_instr < trace + trace_len && !op_is_end(this_instr->opcode);
this_instr++) {

int oparg = inst->oparg;
uint32_t opcode = inst->opcode;
int oparg = this_instr->oparg;
uint32_t opcode = this_instr->opcode;

_Py_UOpsSymType **stack_pointer = ctx->frame->stack_pointer;

Expand Down
10 changes: 5 additions & 5 deletions 10 Python/tier2_redundancy_eliminator_bytecodes.c
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dummy_func(void) {
_Py_UOpsSymType *bottom;
_Py_UOpsAbstractFrame *frame;
_Py_UOpsAbstractInterpContext *ctx;
_PyUOpInstruction *inst;
_PyUOpInstruction *this_instr;
_PyBloomFilter *dependencies;
int modified;

Expand Down Expand Up @@ -64,7 +64,7 @@ dummy_func(void) {
op(_GUARD_BOTH_INT, (left, right -- left, right)) {
if (sym_matches_type(left, &PyLong_Type) &&
sym_matches_type(right, &PyLong_Type)) {
REPLACE_OP(inst, _NOP, 0, 0);
REPLACE_OP(this_instr, _NOP, 0, 0);
}
Comment thread
Fidget-Spinner marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

sym_set_type(left, &PyLong_Type);
sym_set_type(right, &PyLong_Type);
Expand All @@ -73,7 +73,7 @@ dummy_func(void) {
op(_GUARD_BOTH_FLOAT, (left, right -- left, right)) {
if (sym_matches_type(left, &PyFloat_Type) &&
sym_matches_type(right, &PyFloat_Type)) {
REPLACE_OP(inst, _NOP, 0 ,0);
REPLACE_OP(this_instr, _NOP, 0 ,0);
}
sym_set_type(left, &PyFloat_Type);
sym_set_type(right, &PyFloat_Type);
Expand Down Expand Up @@ -188,8 +188,8 @@ dummy_func(void) {

(void)callable;

assert((inst + 2)->opcode == _PUSH_FRAME);
PyFunctionObject *func = (PyFunctionObject *)(inst + 2)->operand;
assert((this_instr + 2)->opcode == _PUSH_FRAME);
Comment thread
Fidget-Spinner marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

PyFunctionObject *func = (PyFunctionObject *)(this_instr + 2)->operand;
if (func == NULL) {
goto error;
}
Expand Down
28 changes: 14 additions & 14 deletions 28 Python/tier2_redundancy_eliminator_cases.c.h
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
left = stack_pointer[-2];
if (sym_matches_type(left, &PyLong_Type) &&
sym_matches_type(right, &PyLong_Type)) {
REPLACE_OP(inst, _NOP, 0, 0);
REPLACE_OP(this_instr, _NOP, 0, 0);
}
sym_set_type(left, &PyLong_Type);
sym_set_type(right, &PyLong_Type);
Expand Down Expand Up @@ -222,7 +222,7 @@
left = stack_pointer[-2];
if (sym_matches_type(left, &PyFloat_Type) &&
sym_matches_type(right, &PyFloat_Type)) {
REPLACE_OP(inst, _NOP, 0 ,0);
REPLACE_OP(this_instr, _NOP, 0 ,0);
}
sym_set_type(left, &PyFloat_Type);
sym_set_type(right, &PyFloat_Type);
Expand Down Expand Up @@ -789,7 +789,7 @@
_Py_UOpsSymType *attr;
_Py_UOpsSymType *null = NULL;
owner = stack_pointer[-1];
uint16_t index = (uint16_t)inst->operand;
uint16_t index = (uint16_t)this_instr->operand;
_LOAD_ATTR_NOT_NULL
(void)index;
(void)owner;
Expand All @@ -808,7 +808,7 @@
_Py_UOpsSymType *attr;
_Py_UOpsSymType *null = NULL;
owner = stack_pointer[-1];
uint16_t index = (uint16_t)inst->operand;
uint16_t index = (uint16_t)this_instr->operand;
_LOAD_ATTR_NOT_NULL
(void)index;
(void)owner;
Expand All @@ -827,7 +827,7 @@
_Py_UOpsSymType *attr;
_Py_UOpsSymType *null = NULL;
owner = stack_pointer[-1];
uint16_t hint = (uint16_t)inst->operand;
uint16_t hint = (uint16_t)this_instr->operand;
_LOAD_ATTR_NOT_NULL
(void)hint;
(void)owner;
Expand All @@ -842,7 +842,7 @@
_Py_UOpsSymType *attr;
_Py_UOpsSymType *null = NULL;
owner = stack_pointer[-1];
uint16_t index = (uint16_t)inst->operand;
uint16_t index = (uint16_t)this_instr->operand;
_LOAD_ATTR_NOT_NULL
(void)index;
(void)owner;
Expand All @@ -861,7 +861,7 @@
_Py_UOpsSymType *attr;
_Py_UOpsSymType *null = NULL;
owner = stack_pointer[-1];
PyObject *descr = (PyObject *)inst->operand;
PyObject *descr = (PyObject *)this_instr->operand;
_LOAD_ATTR_NOT_NULL
(void)descr;
(void)owner;
Expand Down Expand Up @@ -1269,7 +1269,7 @@
_Py_UOpsSymType *callable;
self_or_null = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
uint32_t func_version = (uint32_t)inst->operand;
uint32_t func_version = (uint32_t)this_instr->operand;
sym_set_type(callable, &PyFunction_Type);
(void)self_or_null;
(void)func_version;
Expand All @@ -1290,8 +1290,8 @@
callable = stack_pointer[-2 - oparg];
int argcount = oparg;
(void)callable;
assert((inst + 2)->opcode == _PUSH_FRAME);
PyFunctionObject *func = (PyFunctionObject *)(inst + 2)->operand;
assert((this_instr + 2)->opcode == _PUSH_FRAME);
PyFunctionObject *func = (PyFunctionObject *)(this_instr + 2)->operand;
if (func == NULL) {
goto error;
}
Expand Down Expand Up @@ -1604,7 +1604,7 @@

case _LOAD_CONST_INLINE: {
_Py_UOpsSymType *value;
PyObject *ptr = (PyObject *)inst->operand;
PyObject *ptr = (PyObject *)this_instr->operand;
value = sym_new_const(ctx, ptr);
if (value == NULL) {
goto out_of_space;
Expand All @@ -1616,7 +1616,7 @@

case _LOAD_CONST_INLINE_BORROW: {
_Py_UOpsSymType *value;
PyObject *ptr = (PyObject *)inst->operand;
PyObject *ptr = (PyObject *)this_instr->operand;
value = sym_new_const(ctx, ptr);
if (value == NULL) {
goto out_of_space;
Expand All @@ -1629,7 +1629,7 @@
case _LOAD_CONST_INLINE_WITH_NULL: {
_Py_UOpsSymType *value;
_Py_UOpsSymType *null;
PyObject *ptr = (PyObject *)inst->operand;
PyObject *ptr = (PyObject *)this_instr->operand;
value = sym_new_const(ctx, ptr);
if (value == NULL) {
goto out_of_space;
Expand All @@ -1647,7 +1647,7 @@
case _LOAD_CONST_INLINE_BORROW_WITH_NULL: {
_Py_UOpsSymType *value;
_Py_UOpsSymType *null;
PyObject *ptr = (PyObject *)inst->operand;
PyObject *ptr = (PyObject *)this_instr->operand;
value = sym_new_const(ctx, ptr);
if (value == NULL) {
goto out_of_space;
Expand Down
2 changes: 1 addition & 1 deletion 2 Tools/cases_generator/tier2_abstract_generator.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def write_uop(
else:
type = f"uint{cache.size*16}_t "
cast = f"uint{cache.size*16}_t"
out.emit(f"{type}{cache.name} = ({cast})inst->operand;\n")
out.emit(f"{type}{cache.name} = ({cast})this_instr->operand;\n")
if override:
replacement_funcs = {
"DECREF_INPUTS": decref_inputs,
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.