Skip to content

unittest: Add jit compare for jit IR - #18228

Merged
hrydgard merged 3 commits into
hrydgard:masterfrom
unknownbrackets:ir-jit-unittest
Sep 24, 2023
Merged

hrydgard merged 3 commits into
hrydgard:masterfrom
unknownbrackets:ir-jit-unittest

Conversation

@unknownbrackets

Copy link
Copy Markdown
Collaborator

This makes it so you can easily compare a code block's codegen between:

  • Interpreter
  • IR Interpreter
  • Linear JIT
  • JIT IR

Also adds a thread name for UnitTest so asserts don't break.

-[Unknown]

@unknownbrackets unknownbrackets added the IRInterpreter Occurs with IR Interpreter but not with another CPU backend. label Sep 24, 2023
@hrydgard

Copy link
Copy Markdown
Owner

Oh that's great for microbenching, yeah.

@hrydgard
hrydgard enabled auto-merge September 24, 2023 15:16
@hrydgard

Copy link
Copy Markdown
Owner

Does look like the unittest is actually crashing on Linux, it's not the usual thing...

@unknownbrackets

unknownbrackets commented Sep 24, 2023 •

Copy link
Copy Markdown
Collaborator Author

The unittest was using 0x89100000 as an address. At least on RISC-V, this was sign extending and crashing. Not sure why Linux is unhappy though (Windows is fine and I had a 7FFFFFFF mask there)... I cleaned up the displacements to be safer, though.

-[Unknown]

LI(SCRATCH2, constant);
ADD(SCRATCH1, *reg, SCRATCH2);
// It can't be this negative, must be a constant with top bit set.
if ((constant & 0xC0000000) == 0x80000000) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

shouldn't this check be (constant & 0x80000000)? or are we explicitly diallowing 0xC0000000 addresses (granted, you did mention previously that disabling the cache in kernel space is likely not allowed...)

@unknownbrackets unknownbrackets Sep 24, 2023 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No, because the constant can be a negative offset. We end up turning absolute addresses into this constant offsets, but we also have signed offsets.

-[Unknown]

@hrydgard
hrydgard merged commit 7b2657f into hrydgard:master Sep 24, 2023
@unknownbrackets
unknownbrackets deleted the ir-jit-unittest branch September 24, 2023 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IRInterpreter Occurs with IR Interpreter but not with another CPU backend.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants