intel / ideep

Intel® Optimization for Chainer*, a Chainer module providing numpy like API and DNN acceleration using MKL-DNN.
MIT License
163 stars 88 forks source link

Add computation modes to ideep primitive descriptor cache key #327

Closed robert-hardwick closed 2 months ago

robert-hardwick commented 3 months ago

fpmath_mode, accumulation_mode, scratchpad_mode and deterministic modes are not encoded as part of the key for the PD cache. This can cause subsequent creations of a primitive to ignore changes to these modes ( e.g. during unit tests ).

In particular changing fpmath_mode between subsequent, calls to otherwise identical matmul has no effect since the pd is loaded from cache from previous call.

Using ONEDNN_VERBOSE we could see that the primitive descriptor is loaded from cache and toggling the fpmath mode on/off between subsequent calls didn't have an effect. This code should resolve that issue and other computation modes are added here ( deterministic, scratchpad and accumulation ) to ensure consistency.

yanbing-j commented 2 months ago

@jgong5 Could you please take a look?