Issue #15085 has been updated by wanabe (_ wanabe).

File export-vm_call_super_method.patch added
Status changed from Open to Rejected

I am sorry in advance, I've decided to withdraw this ticket and its patch.
I tried to reveal what's going on and explain it, but end up getting nowhere.

I also tried to explain the reason that I had reached to `vm_search_super_method` and iTLB,
but I had forgotten to write a memo and I can't remember now.

To make matters worse, my assumption "Big function makes iTLB-load-count bad" is totally wrong.
For example, attached "export-vm_call_super_method.patch" shows almost same result on my environment.
(Note that the JIT compile time is as same as trunk)
Although `vm_call_super_method` is a very small function.

```
Warming up --------------------------------------
              a.foo    344.327k i/s
Calculating -------------------------------------
                          trunk  trunk,--jit  export-big-func  export-big-func,--jit  export-vm_call_super_method  export-vm_call_super_method,--jit 
              a.foo    353.285k     224.659k         340.091k               368.875k                     343.167k                           386.849k i/s -      1.033M times in 2.923926s 4.597989s 3.037365s 2.800350s 3.010142s 2.670239s

Comparison:
                           a.foo 
export-vm_call_super_method,--jit:    386849.3 i/s 
export-big-func,--jit:    368875.3 i/s - 1.05x  slower
               trunk:    353285.2 i/s - 1.10x  slower
export-vm_call_super_method:    343166.5 i/s - 1.13x  slower
     export-big-func:    340090.8 i/s - 1.14x  slower
         trunk,--jit:    224659.1 i/s - 1.72x  slower

```

So I gave up this ticket until at least I can explain.
I'm sorry for confusing you.

----------------------------------------
Feature #15085: Decrease memory cache usage of MJIT
https://bugs.ruby-lang.org/issues/15085#change-73997

* Author: wanabe (_ wanabe)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
MJIT makes ruby-methods faster by ordinary, but I have observed that some cases are exceptional.
I guess the one is caused by `invokesuper` instruction.
And I guess it is related to memory caching, especially iTLB.

Attached "export-big-func.patch" makes MJIT binary code for `invokesuper` smaller.
"super.rb" is a benchmark script with benchmark_driver.
"benchmark.log" is a result of super.rb.
"benchmark-with-perf.log" is another result with `PERF_STAT` environment variable.
The results are merely in my environment and depend to a large part on machine specs.

`invokesuper` can get faster with exported `vm_search_super_method()`, but I think it is not enough.
Because `perf stat` shows that there are still many iTLB-load-misses.
I believe MJIT can grow fast with good care for CPU memory cache, not only iTLB but also L1 / L2 and so on.

---Files--------------------------------
export-big-func.patch (934 Bytes)
super.rb (897 Bytes)
benchmark.log (624 Bytes)
benchmark-with-perf.log (7.05 KB)
export-vm_call_super_method.patch (2.66 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>