[wasm-wide-arith] Implement add128 for ia32 architecture in Turboshaft [v8/v8 : main]

0 views
Skip to first unread message

Ryan Diaz (Gerrit)

unread,
12:16 AM (19 hours ago) 12:16 AM
to Clemens Backes, Jakob Kummerow, Deepti Gandluri, v8-s...@luci-project-accounts.iam.gserviceaccount.com, android-bu...@system.gserviceaccount.com, v8-re...@googlegroups.com, was...@google.com
Attention needed from Clemens Backes and Jakob Kummerow

Ryan Diaz added 1 comment

File src/wasm/wasm-external-refs.cc
Line 369, Patchset 7 (Latest): uint64_t* ptr = reinterpret_cast<uint64_t*>(data);
Ryan Diaz . unresolved

My research seemed to indicate that I can't use a `__int128_t` because it isn't accessible when compiling for 32 bit architectures, but not sure if that is true.

Open in Gerrit

Related details

Attention is currently required from:
  • Clemens Backes
  • Jakob Kummerow
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: If3507e9606ad99f682062ee66bb50577100e33a7
Gerrit-Change-Number: 7797503
Gerrit-PatchSet: 7
Gerrit-Owner: Ryan Diaz <ryan...@chromium.org>
Gerrit-Reviewer: Clemens Backes <clem...@chromium.org>
Gerrit-Reviewer: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Reviewer: Ryan Diaz <ryan...@chromium.org>
Gerrit-CC: Deepti Gandluri <gde...@chromium.org>
Gerrit-Attention: Clemens Backes <clem...@chromium.org>
Gerrit-Attention: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Apr 2026 04:16:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Clemens Backes (Gerrit)

unread,
4:42 AM (15 hours ago) 4:42 AM
to Ryan Diaz, Jakob Kummerow, Deepti Gandluri, v8-s...@luci-project-accounts.iam.gserviceaccount.com, android-bu...@system.gserviceaccount.com, v8-re...@googlegroups.com, was...@google.com
Attention needed from Jakob Kummerow and Ryan Diaz

Clemens Backes voted and added 3 comments

Votes added by Clemens Backes

Code-Review+1

3 comments

Patchset-level comments
File-level comment, Patchset 7 (Latest):
Clemens Backes . resolved

LGTM with comments.

File src/wasm/turboshaft-graph-interface.cc
Line 931, Patchset 7 (Latest): constexpr int kSlotSize = MemoryRepresentation::Uint64().SizeInBytes();
Clemens Backes . unresolved

Why not just `kInt64Size`?

Line 933, Patchset 7 (Latest): __ StackSlot(kSlotSize * 4, kSlotSize);
Clemens Backes . unresolved

As discussed over mail, this can create huge stack frames because the stack memory is not shared. That's maybe something to fix more generally in Turboshaft, but we should keep it in mind.

Open in Gerrit

Related details

Attention is currently required from:
  • Jakob Kummerow
  • Ryan Diaz
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: If3507e9606ad99f682062ee66bb50577100e33a7
Gerrit-Change-Number: 7797503
Gerrit-PatchSet: 7
Gerrit-Owner: Ryan Diaz <ryan...@chromium.org>
Gerrit-Reviewer: Clemens Backes <clem...@chromium.org>
Gerrit-Reviewer: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Reviewer: Ryan Diaz <ryan...@chromium.org>
Gerrit-CC: Deepti Gandluri <gde...@chromium.org>
Gerrit-Attention: Ryan Diaz <ryan...@chromium.org>
Gerrit-Attention: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Apr 2026 08:42:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Jakob Kummerow (Gerrit)

unread,
5:51 AM (14 hours ago) 5:51 AM
to Ryan Diaz, Jakob Kummerow, Clemens Backes, Deepti Gandluri, v8-s...@luci-project-accounts.iam.gserviceaccount.com, android-bu...@system.gserviceaccount.com, v8-re...@googlegroups.com, was...@google.com
Attention needed from Ryan Diaz

Jakob Kummerow voted and added 3 comments

Votes added by Jakob Kummerow

Code-Review+1

3 comments

Patchset-level comments
Jakob Kummerow . resolved

LGTM with comments.

File src/wasm/turboshaft-graph-interface.cc
Line 933, Patchset 7 (Latest): __ StackSlot(kSlotSize * 4, kSlotSize);
Clemens Backes . unresolved

As discussed over mail, this can create huge stack frames because the stack memory is not shared. That's maybe something to fix more generally in Turboshaft, but we should keep it in mind.

Jakob Kummerow

I'd be fine with leaving this as is for now and improving it in a follow-up, but I think it's so easy that we might as well do it right away: look at `parent_frame_state_` for precedent of an IR node that's cached on the graph builder. Introduce a similar `OptionalV<WordPtr> wide_ops_stack_buffer_`, wrap it in an accessor `GetWideOpsStackBuffer() { ... }` that creates it on demand and returns it as non-optional `V<WordPtr>`, and that should already be enough to do the trick. I'd hard-code `static constexpr int kWideOpsStackBufferSize = 4 * kInt64Size`, and then add a `static_assert(k…Size >= 4 * kSlotSize)` guard here just to set a precedent for possible future ops that might want to reuse that buffer and need other sizes.

File src/wasm/wasm-external-refs.cc
Line 369, Patchset 7 (Latest): uint64_t* ptr = reinterpret_cast<uint64_t*>(data);
Ryan Diaz . unresolved

My research seemed to indicate that I can't use a `__int128_t` because it isn't accessible when compiling for 32 bit architectures, but not sure if that is true.

Jakob Kummerow

Oh, bummer.
Please add a comment, roughly `We need this in particular for 32-bit platforms, where __uint128_t is not available.`

Open in Gerrit

Related details

Attention is currently required from:
  • Ryan Diaz
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: If3507e9606ad99f682062ee66bb50577100e33a7
Gerrit-Change-Number: 7797503
Gerrit-PatchSet: 7
Gerrit-Owner: Ryan Diaz <ryan...@chromium.org>
Gerrit-Reviewer: Clemens Backes <clem...@chromium.org>
Gerrit-Reviewer: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Reviewer: Ryan Diaz <ryan...@chromium.org>
Gerrit-CC: Deepti Gandluri <gde...@chromium.org>
Gerrit-Attention: Ryan Diaz <ryan...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Apr 2026 09:51:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Ryan Diaz <ryan...@chromium.org>
Comment-In-Reply-To: Clemens Backes <clem...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ryan Diaz (Gerrit)

unread,
2:56 PM (5 hours ago) 2:56 PM
to Jakob Kummerow, Clemens Backes, Deepti Gandluri, v8-s...@luci-project-accounts.iam.gserviceaccount.com, android-bu...@system.gserviceaccount.com, v8-re...@googlegroups.com, was...@google.com
Attention needed from Clemens Backes and Jakob Kummerow

Ryan Diaz added 3 comments

File src/wasm/turboshaft-graph-interface.cc
Line 931, Patchset 7: constexpr int kSlotSize = MemoryRepresentation::Uint64().SizeInBytes();
Clemens Backes . resolved

Why not just `kInt64Size`?

Ryan Diaz

yes, I forgot that constant existed :) using that now

Line 933, Patchset 7: __ StackSlot(kSlotSize * 4, kSlotSize);
Clemens Backes . resolved

As discussed over mail, this can create huge stack frames because the stack memory is not shared. That's maybe something to fix more generally in Turboshaft, but we should keep it in mind.

Jakob Kummerow

I'd be fine with leaving this as is for now and improving it in a follow-up, but I think it's so easy that we might as well do it right away: look at `parent_frame_state_` for precedent of an IR node that's cached on the graph builder. Introduce a similar `OptionalV<WordPtr> wide_ops_stack_buffer_`, wrap it in an accessor `GetWideOpsStackBuffer() { ... }` that creates it on demand and returns it as non-optional `V<WordPtr>`, and that should already be enough to do the trick. I'd hard-code `static constexpr int kWideOpsStackBufferSize = 4 * kInt64Size`, and then add a `static_assert(k…Size >= 4 * kSlotSize)` guard here just to set a precedent for possible future ops that might want to reuse that buffer and need other sizes.

Ryan Diaz

Thank you for the explanation. Makes a lot of sense I was hesitant to add an instance variable for this, but seems like it was always going to be necessary. Done.

File src/wasm/wasm-external-refs.cc
Line 369, Patchset 7: uint64_t* ptr = reinterpret_cast<uint64_t*>(data);
Ryan Diaz . resolved

My research seemed to indicate that I can't use a `__int128_t` because it isn't accessible when compiling for 32 bit architectures, but not sure if that is true.

Jakob Kummerow

Oh, bummer.
Please add a comment, roughly `We need this in particular for 32-bit platforms, where __uint128_t is not available.`

Ryan Diaz

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Clemens Backes
  • Jakob Kummerow
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: If3507e9606ad99f682062ee66bb50577100e33a7
Gerrit-Change-Number: 7797503
Gerrit-PatchSet: 7
Gerrit-Owner: Ryan Diaz <ryan...@chromium.org>
Gerrit-Reviewer: Clemens Backes <clem...@chromium.org>
Gerrit-Reviewer: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Reviewer: Ryan Diaz <ryan...@chromium.org>
Gerrit-CC: Deepti Gandluri <gde...@chromium.org>
Gerrit-Attention: Clemens Backes <clem...@chromium.org>
Gerrit-Attention: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Apr 2026 18:56:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ryan Diaz <ryan...@chromium.org>
Comment-In-Reply-To: Clemens Backes <clem...@chromium.org>
Comment-In-Reply-To: Jakob Kummerow <jkum...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ryan Diaz (Gerrit)

unread,
2:56 PM (5 hours ago) 2:56 PM
to Jakob Kummerow, Clemens Backes, Deepti Gandluri, v8-s...@luci-project-accounts.iam.gserviceaccount.com, android-bu...@system.gserviceaccount.com, v8-re...@googlegroups.com, was...@google.com
Attention needed from Clemens Backes and Jakob Kummerow

Ryan Diaz voted Auto-Submit+1

Auto-Submit+1
Open in Gerrit

Related details

Attention is currently required from:
  • Clemens Backes
  • Jakob Kummerow
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: If3507e9606ad99f682062ee66bb50577100e33a7
Gerrit-Change-Number: 7797503
Gerrit-PatchSet: 8
Gerrit-Owner: Ryan Diaz <ryan...@chromium.org>
Gerrit-Reviewer: Clemens Backes <clem...@chromium.org>
Gerrit-Reviewer: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Reviewer: Ryan Diaz <ryan...@chromium.org>
Gerrit-CC: Deepti Gandluri <gde...@chromium.org>
Gerrit-Attention: Clemens Backes <clem...@chromium.org>
Gerrit-Attention: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Apr 2026 18:56:39 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages