oneDNN icon indicating copy to clipboard operation
oneDNN copied to clipboard

Understand oneDNN graph compiler

Open akote123 opened this issue 1 year ago • 8 comments

Hi, I wanted to understand from framework like Tensorflow or Pytorch how we can enable graph compiler.

cc:@ZhennanQin

Thank you

akote123 avatar Feb 05 '24 12:02 akote123

Hi Aruna,

The framework integration is WIP, you may check the status from framework RFC. Currently, the recommended way to try graph compiler with pytorch, is to use IPEX. Graph compiler is enabled by default in its INT8 path, for other data types like float32 or bfloat16, you need to manually turn on oneDNN graph by inserting the below line in the beginning of your model script:

ipex._C.set_llga_fp32_bf16_enabled(True)

ZhennanQin avatar Feb 05 '24 12:02 ZhennanQin

@ZhennanQin Thank you

akote123 avatar Feb 06 '24 03:02 akote123

@ZhennanQin , I was going through the https://arxiv.org/abs/2301.01333, after TensorIR how it calls batch reduce kernel and also I want understand where exactly the microkernel file location in oneDNN repository.

akote123 avatar Feb 06 '24 09:02 akote123

The brgemm interface location: https://github.com/oneapi-src/oneDNN/blob/main/src/cpu/x64/brgemm/brgemm.hpp

ZhennanQin avatar Feb 06 '24 10:02 ZhennanQin

@ZhennanQin ,Graph compiler calls microkernel from primitive APIs? How Tensor IR is connected to this?

akote123 avatar Feb 06 '24 10:02 akote123

Graph compiler shares the same microkernel implementation with primitive. The brgemm abstraction in graph compiler can be found at: https://github.com/oneapi-src/oneDNN/blob/main/src/graph/backend/graph_compiler/core/src/runtime/microkernel/cpu/microkernel.hpp

ZhennanQin avatar Feb 06 '24 12:02 ZhennanQin

@ZhennanQin , Thank you.

akote123 avatar Feb 06 '24 13:02 akote123