From 464f65b16725401dadcdcf91c03f593fa4671cea Mon Sep 17 00:00:00 2001 From: ronnywang <524019753@qq.com> Date: Tue, 15 Mar 2022 12:27:05 +0800 Subject: [PATCH] add CHECK_VERSION macro (#40512) --- paddle/phi/backends/device_ext.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/paddle/phi/backends/device_ext.h b/paddle/phi/backends/device_ext.h index bbd4966b727..6315fe15afd 100644 --- a/paddle/phi/backends/device_ext.h +++ b/paddle/phi/backends/device_ext.h @@ -523,6 +523,15 @@ struct CustomRuntimeParams { char reserved[32]; }; +#define PADDLE_CUSTOM_RUNTIME_CHECK_VERSION(params) \ + if ((params)->size != sizeof(DevicePluginParams) && \ + (params)->interface->size != sizeof(C_DeviceInterface)) { \ + return; \ + } \ + (params)->version.major = PADDLE_DEVICE_PLUGIN_MAJOR_VERSION; \ + (params)->version.minor = PADDLE_DEVICE_PLUGIN_MINOR_VERSION; \ + (params)->version.patch = PADDLE_DEVICE_PLUGIN_PATCH_VERSION; + // Plugin implement it and fill CustomRuntimeParams void InitPlugin(CustomRuntimeParams*); -- GitLab