Interpreting `JET` warnings on a simple `Polyester` multithreaded loop

Krastanov
Sun, 03 Jul 2022 02:45:42 +0000
Performance

Polyester seems to be one of the bigger sources of TTFX in some of my libraries. It is similarly the main source of warnings when using JET. Below is a very simple multi-threaded loop that causes a large number of JET warnings (both in 1.7.0 and in nightly). I do not have much understanding of ThreadingUtilities and of StaticArrays, where the warnings originate. Would someone be able to guide me where to look for improvements or how I can change my function, in order to silence the JET warnings and make sure there is no risk of runtime dispatch?

julia> using JET, Polyester

julia> function a(m::Matrix, i::Int)
           @batch for r in axes(m,1)
               m[r,:] .+= i
           end
       end
a (generic function with 1 method)

julia> m = rand(Int,5,5)

julia> @report_opt a(m,1)
═════ 92 possible errors found ═════
...

With these versions

  [c3a54625] JET v0.5.16
  [f517fe37] Polyester v0.6.13
  [aedffcd0] Static v0.7.5
  [90137ffa] StaticArrays v1.5.0
  [8290d209] ThreadingUtilities v0.5.0

8 posts - 4 participants