First matrix product takes 2–3× longer to compile with GPUArrays 12.3.0: `mul!` compiles every branch's kernel launches

Đang mở
#866 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
julia
Lĩnh vực
performance

Hướng nghiên cứu

Start with the mul! paths in GPUArrays 12.3.0 described in the report, especially generic_matmatmul!, tiled_matmatmul!, and the storage-level methods from #852; compare them with the matvec kernels from #855. Reproduce the first-call timings with the supplied JLArrays example and --trace-compile-timing. Done means identifying and addressing the unnecessary host compilation while preserving the reported matrix product behavior and validating the fresh-process timings.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I saw this on the TTFX graph, this might be intended but thought I would open an issue in case it is not.


🤖

The first A * b on a JLArray went from about 0.7 s to 2.0 s between GPUArrays 12.2.0 and 12.3.0.

using JLArrays
A = jl(rand(3, 3)); b = jl(rand(3))
@time A * b

First call in a fresh process with the JIT object cache cleared, in ms:

A*b A*B A'*b Symmetric(A)*b A*A'
12.2.0 708 677 708 722 694
12.3.0 1997 1226 1969 2141 1246

The kernel itself compiles in about 0.2 s as before. The rest is host code: --trace-compile-timing attributes about 1.4 s to *(::JLArray{Float64, 2}, ::JLArray{Float64, 1}), up from about 60 ms.

Compiling that one method now specializes the kernel compile-and-launch code for kernels the call never runs:

  • LinearAlgebra.@stable_muladdmul in generic_matmatmul! and tiled_matmatmul! expands to a branch per MulAddMul type, so everything below it is compiled four times.
  • The storage-level mul! methods from #852 reach, statically, _rmul_or_fill! (fill and scale kernels), the reshape fallback into the matrix mul!, and blas_syrk!/blas_herk! with copytri! (four kernels).
  • The matvec kernels from #855 loop over a StepRange, whose construction can throw. That sends the kernel through GPUCompiler's exception-site code, which is not precompiled (about 100 ms).
Ngôn ngữ chính
Julia
Star
462
Fork
109
Merge trung bình
4 ngày 11 giờ
Pull request đã merge (30 ngày)
26

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của JuliaGPU/GPUArrays.jl

Tất cả issue của JuliaGPU/GPUArrays.jl

Issue tương tự

Thêm issue về Julia

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.