Re: [v8-dev] Re: How to enable turboshaft in v8_unittests?

2024-06-02 Thread 'dmerc...@google.com' via v8-dev
Hi there, Nico and Matthias said it all already pretty much, but, for completeness and to give an example, here are the CLs that ported the x64 instruction selector unit tests: - https://chromium-review.googlesource.com/c/v8/v8/+/5368860 - https://chromium-review.googlesource.com/c/v8/v8/+/5

Re: [v8-dev] wasm simd pairwise matching

2024-06-05 Thread 'dmerc...@google.com' via v8-dev
And one more thing that will be nicer in a Reducer than in the instruction selector: you don't have to worry about CanCover :o :o :o Btw, as far as I can tell, there is no corresponding Intel operations for vaddvq (which I guess is what you want to generate), but I think that it's still better

[v8-dev] Re: Reasons for optimizations not supported by TurboFan

2023-09-13 Thread 'dmerc...@google.com' via v8-dev
Hi, In general, LLVM and ahead-of-time compilers have all the time in the world to optimize a function, while Turbofan tries to save every millisecond it can (it's not quite true: LLVM also tries to compile somewhat quickly, but it's orders of magnitude slower that Turbofan). As a result, Turbo

Re: [v8-dev] Re: Reasons for optimizations not supported by TurboFan

2023-09-14 Thread 'dmerc...@google.com' via v8-dev
)" instead of "X / (C2 / C1)". > > Nah they probably meant just that. (X * 2) / 10 is X / (10 / 2) aka X / 5, > not X * (10 / 2) aka X * 5. > > It would be the same as X * (C1 / C2) though, that's another possible > simplification (if things don't ov

Re: [v8-dev] How enter this optimization path?

2023-10-10 Thread 'dmerc...@google.com' via v8-dev
Hi, Interestingly, even function Foo(s) { return s + "42"; } Is enough to reach this case. Basically, as Leszek said, this happens when we have generic JSAdd and we can infer that one of the inputs is a String. In your example ("a + b"), we don't go into this path because we cann

Re: [v8-dev] turboshaft isel failure with projections

2023-11-08 Thread 'dmerc...@google.com' via v8-dev
Hi, > With a turbofan-only flow, the overflow operation and the projection will be duplicated for the second branch, and everything is fine. I'm not sure which phase could duplicate a Int32AddWithOverflow. I don't think that the Instruction Selector does this. It could be an artifact of schedu

Re: [v8-dev] turboshaft isel failure with projections

2023-11-09 Thread 'dmerc...@google.com' via v8-dev
Arf sorry, I read a bit too quickly your initial message and missed that you were trying to remove a CanCover in VisitWordCompareZero. > Surely we should be able to combine an operation even if it has multiple users? Yes, we should (but we don't). We've been thinking about relaxing some CanCov

[v8-dev] Re: What's the difference between REDUCE(operation) and REDUCE_INPUT_GRAPH(operation) in turboshaft?

2023-11-23 Thread 'dmerc...@google.com' via v8-dev
Hi, First: a Turboshaft phase that uses OptimizationPhase creates a copy of the graph. The old graph is referred to as input_graph and the newly created graph is the output_graph. This works by reducing each operation one by one (where each reduction creates a new operation in the output_graph)

[v8-dev] Re: Lowering/isel of load with offset

2025-02-20 Thread 'dmerc...@google.com' via v8-dev
Hi, >From a quick look, it seems Simd128LaneMemoryOps are only created in wasm/turboshaft-graph-interface.cc, and there, the offset is always 0. Then, there is no phases at all that reduces (or even looks at for that matter) Simd128LaneMemoryOp, so when we reach the ISEL, the offset should sti

Re: [v8-dev] Clarification on loop terminology

2025-07-11 Thread 'dmerc...@google.com' via v8-dev
Hi Sam, > This seems to suggest that block->loop_end() is the first block inside the loop, is this true?! If so, I hope it's clear why this is confusing :) The comment on GetLoopEndRpo explains what loop_end is: // In Turbofan, the `block->loop_end()` refers to the first after (outside) //

[v8-dev] Re: How does V8 implement add (IntPtrAddWithOverflow)?

2025-09-03 Thread 'dmerc...@google.com' via v8-dev
Hi, `raw_assembler()->IntPtrAddWithOverflow(a, b)` goes to `INTPTR_BINOP(Int, AddWithOverflow)` in raw-machine-assembler.h line 639, which expands to: ``` Node* IntPtrAddWithOverflow(Node* a, Node* b) { return kSystemPointerSize == 8 ? Int64AddWithOverflow(a, b)

[v8-dev] Re: CPU-feature dependent code in builtins

2025-09-05 Thread 'dmerc...@google.com' via v8-dev
Hi, > have a dynamic branch looking at the CPU feature in the generated assembly. I would suggest to do this. You can look for instance at `IncsspqIfSupported` in builtins-x64.cc to see how you can retrieve CpuFeatures at runtime from builtins. And another example is the `supports_wasm_simd_1