Skip to content

Refactor of the kernel dispatch API #810

@diptorupd

Description

@diptorupd

The existing kernel dispatch API in numba_dpex.compiler.py is sub-optimal. There are several problems with the code:

  • Interleaved code between dispatching a kernel and the actual representation of a kernel
  • Error messages are a mix of prints and ValueError and TypeError with abstruse messages.
  • Improve the USMArrayType.
  • the deprecated dpctl.get_current_queue call is embedded inside the API making it hard to separate out the legacy dpctl.device_context support from the compute-follows-data programming model.
  • There is no check on device backend. We always assume that the device supports SPIR-V.
  • Pass llvm bitcode to llvm-spirv using stdin rather than first serializing the bitcode to disk #862
  • Caching of kernels uses a dictionary and can lead to a growing memory footprint of a dpex program. Instead, Numba's caching mechanism should be used to cache compiled kernel functions.
  • The check for legal global ranges is commented out.
  • Compiling a kernel with a specific signature always uses dpctl.get_current_queue

The code is also not properly documented nor are there API documentation generated. Unit test coverage can be improved too.

  • Generate API documentation and developer guide for the kernel API.
  • Update examples to use compute-follows-data for kernels.
  • Generate class UML diagrams.

These issues have to be fixed before new feature development and bug fixes can be implemented for the dpex kernel API.

#804 is a WIP PR to fix these issues and make the API modular and properly documented with high coverage.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions