Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enables adding overload to DpexExpKernelTarget and fully inline them into the final module. #1230

Merged
merged 8 commits into from
Dec 7, 2023

Conversation

diptorupd
Copy link
Contributor

@diptorupd diptorupd commented Nov 25, 2023

  • Have you provided a meaningful PR description?
    Add a new device_func decorator to compile DpexKernelTarget overloads

    • A new generate_device_ir option for DpexTargetDescriptor is introduced. The new option can be used to prevent a module to be compiled to device IR binary.
    • A new device_func decorator that is registered to compile overloads in DpexExpKernelTarget. The device_func decorated
      functions are not compiled to device IR.
    • The kernel decorator is updated to compile a finalized module to device IR.
  • Have you added a test, reproducer or referred to an issue with a reproducer?

  • Have you tested your changes locally for CPU and GPU devices?

  • Have you made sure that new changes do not introduce compiler warnings?

  • If this PR is a work in progress, are you filing the PR as a draft?

@diptorupd diptorupd requested a review from adarshyoga November 25, 2023 20:55
@diptorupd diptorupd marked this pull request as draft November 25, 2023 20:55
@diptorupd diptorupd force-pushed the experimental/enable_overloads branch 3 times, most recently from 83806ee to c22f8a3 Compare November 28, 2023 04:41
@diptorupd
Copy link
Contributor Author

diptorupd commented Nov 28, 2023

Unit tests design sketch

  • Basic overload end to end
  • compilation_mode option in decorator (negative test case)
  • check if overloads are available in DpexExpKerneltarget._defns and no other target
  • kernel return error (copy from existing core test case)
  • inlining : check if can be set using decorator
  • inlining : check if overload gets fully inlined or not (two cases) (LLVM IR level)

@diptorupd diptorupd marked this pull request as ready for review November 28, 2023 21:57
@diptorupd diptorupd force-pushed the experimental/enable_overloads branch from 0685c43 to cf04418 Compare November 28, 2023 21:58
@diptorupd diptorupd force-pushed the experimental/enable_overloads branch from cf04418 to 788053d Compare December 1, 2023 15:33
Diptorup Deb added 3 commits December 3, 2023 19:46
    - A new target option was added for the DpexKernelTarget
      target to compile functions using the experimental
      KernelDispatcher differently based on whether they are
      "kernels" or "device functions".

      kernels have the spir_kernel calling convention, cannot
      return a value, enforce execution queue equivalence, and
      are always compiled down to device IR (SPIR-V).

      device functions have the spir_func calling convention, do
      not have the same restrictions on return value and input
      arguments and are only compiled to LLVM bitcode.

    - A device_func decorator was added to experimental module.
      The new decorator is roughly equivalent to numba_dpex.func
      but uses the new KernelDispatcher and the compilation mode
      of device function.

      The `device_func` decorator is registered to compile
      overloads in DpexExpkernelTarget.

    - In the kernel compilation mode the final LLVM module is now
      "finaliozed" before conversion to SPIR-V. During finalization
      all overload calls are linked into the main (kernel) module
      and optionally inlined.
    - A new target option "inlining threshold" was added to
      DpexKernelTarget to define how the LLVM inlining passes
      should optimize the final codegen library.

      The decorator-level option will supersede any global
      configuration setting.
@diptorupd diptorupd force-pushed the experimental/enable_overloads branch from 788053d to f4533b4 Compare December 4, 2023 01:46
Diptorup Deb added 2 commits December 6, 2023 17:59
    - Addresses review comments on how to properly set the
      inline_threshold target option
@diptorupd diptorupd force-pushed the experimental/enable_overloads branch from f4533b4 to ca1ef70 Compare December 7, 2023 00:00
@diptorupd diptorupd force-pushed the experimental/enable_overloads branch from ca1ef70 to 0af4414 Compare December 7, 2023 04:15
@diptorupd diptorupd merged commit d1700ff into main Dec 7, 2023
40 of 44 checks passed
@diptorupd diptorupd deleted the experimental/enable_overloads branch December 7, 2023 06:05
github-actions bot added a commit that referenced this pull request Dec 7, 2023
Enables adding overload to DpexExpKernelTarget and fully inline them into the final module. d1700ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants