已合并
修改相关issue文档 #5310
jcmrn0930创建于 21 天前
修改相关issue文档 #5310
已合并
从已删除 :issue合入到cann/asc-devkitmaster
共 4 个文件变更+25-9
| @@ -16,7 +16,7 @@ uint32_t GetLibApiWorkSpaceSize(void) const | |||
| 16 | 16 | ||
| 17 | ## 返回值说明<a name="zh-cn_topic_0000001663835704_zh-cn_topic_0000001391767420_section25791320141317"></a> | 17 | ## 返回值说明<a name="zh-cn_topic_0000001663835704_zh-cn_topic_0000001391767420_section25791320141317"></a> |
| 18 | 18 | ||
| 19 | -返回uint32\_t数据类型的结果,该结果代表当前系统workspace的大小,单位为字节。 | 19 | +返回uint32\_t数据类型的结果,该结果代表当前系统workspace的大小,单位为字节。接口正常返回workspace大小,当返回`std::numeric_limits<uint32_t>::max()`(即`UINT32_MAX`)则接口异常。 |
| 20 | 20 | ||
| 21 | ## 约束说明<a name="zh-cn_topic_0000001663835704_zh-cn_topic_0000001391767420_section19165124931511"></a> | 21 | ## 约束说明<a name="zh-cn_topic_0000001663835704_zh-cn_topic_0000001391767420_section19165124931511"></a> |
| 22 | 22 | ||
| @@ -34,9 +34,11 @@ static ge::graphStatus TilingFunc(gert::TilingContext* context) | |||
| 34 | // 如需要使用系统workspace需要调用GetLibApiWorkSpaceSize获取系统workspace的大小。 | 34 | // 如需要使用系统workspace需要调用GetLibApiWorkSpaceSize获取系统workspace的大小。 |
| 35 | auto ascendcPlatform = platform_ascendc:: PlatformAscendC(context->GetPlatformInfo()); | 35 | auto ascendcPlatform = platform_ascendc:: PlatformAscendC(context->GetPlatformInfo()); |
| 36 | uint32_t sysWorkspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); | 36 | uint32_t sysWorkspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); |
| 37 | + if (sysWorkspaceSize == std::numeric_limits<uint32_t>::max()) { | ||
| 38 | + return ge::GRAPH_FAILED; | ||
| 39 | + } | ||
| 37 | size_t *currentWorkspace = context->GetWorkspaceSizes(1); // 通过框架获取workspace的指针,GetWorkspaceSizes入参为所需workspace的块数。当前限制使用一块。 | 40 | size_t *currentWorkspace = context->GetWorkspaceSizes(1); // 通过框架获取workspace的指针,GetWorkspaceSizes入参为所需workspace的块数。当前限制使用一块。 |
| 38 | currentWorkspace[0] = usrSize + sysWorkspaceSize; // 设置总的workspace的数值大小,总的workspace空间由框架来申请并管理。 | 41 | currentWorkspace[0] = usrSize + sysWorkspaceSize; // 设置总的workspace的数值大小,总的workspace空间由框架来申请并管理。 |
| 39 | ... | 42 | ... |
| 40 | } | 43 | } |
| 41 | ``` | 44 | ``` |
| 42 | - | ||
| @@ -16,7 +16,7 @@ uint32_t GetResCubeGroupWorkSpaceSize(void) const | |||
| 16 | 16 | ||
| 17 | ## 返回值说明<a name="zh-cn_topic_0000001969965338_zh-cn_topic_0000001391767420_section25791320141317"></a> | 17 | ## 返回值说明<a name="zh-cn_topic_0000001969965338_zh-cn_topic_0000001391767420_section25791320141317"></a> |
| 18 | 18 | ||
| 19 | -当前CreateCubeResGroup所需要的workspace空间大小。 | 19 | +当前CreateCubeResGroup所需要的workspace空间大小。接口正常返回workspace大小,当返回`std::numeric_limits<uint32_t>::max()`(即`UINT32_MAX`)则接口异常。 |
| 20 | 20 | ||
| 21 | ## 约束说明<a name="zh-cn_topic_0000001969965338_zh-cn_topic_0000001391767420_section19165124931511"></a> | 21 | ## 约束说明<a name="zh-cn_topic_0000001969965338_zh-cn_topic_0000001391767420_section19165124931511"></a> |
| 22 | 22 | ||
| @@ -33,11 +33,17 @@ static ge::graphStatus TilingFunc(gert::TilingContext* context) | |||
| 33 | // 如需要使用系统workspace需要调用GetLibApiWorkSpaceSize获取系统workspace的大小。 | 33 | // 如需要使用系统workspace需要调用GetLibApiWorkSpaceSize获取系统workspace的大小。 |
| 34 | auto ascendcPlatform = platform_ascendc:: PlatformAscendC(context->GetPlatformInfo()); | 34 | auto ascendcPlatform = platform_ascendc:: PlatformAscendC(context->GetPlatformInfo()); |
| 35 | uint32_t sysWorkspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); | 35 | uint32_t sysWorkspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); |
| 36 | + if (sysWorkspaceSize == std::numeric_limits<uint32_t>::max()) { | ||
| 37 | + return ge::GRAPH_FAILED; | ||
| 38 | + } | ||
| 36 | // 设置用户需要使用的workspace和CreateCubeResGroup需要的大小作为usrWorkspace的总大小。 | 39 | // 设置用户需要使用的workspace和CreateCubeResGroup需要的大小作为usrWorkspace的总大小。 |
| 37 | - size_t usrSize = 256 + ascendcPlatform.GetResCubeGroupWorkSpaceSize(); | 40 | + uint32_t cubeGroupWorkspaceSize = ascendcPlatform.GetResCubeGroupWorkSpaceSize(); |
| 41 | + if (cubeGroupWorkspaceSize == std::numeric_limits<uint32_t>::max()) { | ||
| 42 | + return ge::GRAPH_FAILED; | ||
| 43 | + } | ||
| 44 | + size_t usrSize = 256 + cubeGroupWorkspaceSize; | ||
| 38 | size_t *currentWorkspace = context->GetWorkspaceSizes(1); // 通过框架获取workspace的指针,GetWorkspaceSizes入参为所需workspace的块数。当前限制使用一块。 | 45 | size_t *currentWorkspace = context->GetWorkspaceSizes(1); // 通过框架获取workspace的指针,GetWorkspaceSizes入参为所需workspace的块数。当前限制使用一块。 |
| 39 | currentWorkspace[0] = usrSize + sysWorkspaceSize; // 设置总的workspace的数值大小,总的workspace空间由框架来申请并管理。 | 46 | currentWorkspace[0] = usrSize + sysWorkspaceSize; // 设置总的workspace的数值大小,总的workspace空间由框架来申请并管理。 |
| 40 | ... | 47 | ... |
| 41 | } | 48 | } |
| 42 | ``` | 49 | ``` |
| 43 | - | ||
| @@ -16,7 +16,7 @@ uint32_t GetResGroupBarrierWorkSpaceSize(void) const | |||
| 16 | 16 | ||
| 17 | ## 返回值说明<a name="zh-cn_topic_0000001969805546_zh-cn_topic_0000001391767420_section25791320141317"></a> | 17 | ## 返回值说明<a name="zh-cn_topic_0000001969805546_zh-cn_topic_0000001391767420_section25791320141317"></a> |
| 18 | 18 | ||
| 19 | -当前GroupBarrier所需要的workspace大小。 | 19 | +当前GroupBarrier所需要的workspace大小。接口正常返回workspace大小,当返回`std::numeric_limits<uint32_t>::max()`(即`UINT32_MAX`)则接口异常。 |
| 20 | 20 | ||
| 21 | ## 约束说明<a name="zh-cn_topic_0000001969805546_zh-cn_topic_0000001391767420_section19165124931511"></a> | 21 | ## 约束说明<a name="zh-cn_topic_0000001969805546_zh-cn_topic_0000001391767420_section19165124931511"></a> |
| 22 | 22 | ||
| @@ -33,11 +33,17 @@ static ge::graphStatus TilingFunc(gert::TilingContext* context) | |||
| 33 | // 如需要使用系统workspace需要调用GetLibApiWorkSpaceSize获取系统workspace的大小。 | 33 | // 如需要使用系统workspace需要调用GetLibApiWorkSpaceSize获取系统workspace的大小。 |
| 34 | auto ascendcPlatform = platform_ascendc:: PlatformAscendC(context->GetPlatformInfo()); | 34 | auto ascendcPlatform = platform_ascendc:: PlatformAscendC(context->GetPlatformInfo()); |
| 35 | uint32_t sysWorkspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); | 35 | uint32_t sysWorkspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); |
| 36 | + if (sysWorkspaceSize == std::numeric_limits<uint32_t>::max()) { | ||
| 37 | + return ge::GRAPH_FAILED; | ||
| 38 | + } | ||
| 36 | // 设置用户需要使用的workspace和GroupBarrier需要的大小作为usrWorkspace的总大小。 | 39 | // 设置用户需要使用的workspace和GroupBarrier需要的大小作为usrWorkspace的总大小。 |
| 37 | - size_t usrSize = 256 + ascendcPlatform.GetResGroupBarrierWorkSpaceSize(); // 设置用户需要使用的workspace大小。 | 40 | + uint32_t groupBarrierWorkspaceSize = ascendcPlatform.GetResGroupBarrierWorkSpaceSize(); |
| 41 | + if (groupBarrierWorkspaceSize == std::numeric_limits<uint32_t>::max()) { | ||
| 42 | + return ge::GRAPH_FAILED; | ||
| 43 | + } | ||
| 44 | + size_t usrSize = 256 + groupBarrierWorkspaceSize; // 设置用户需要使用的workspace大小。 | ||
| 38 | size_t *currentWorkspace = context->GetWorkspaceSizes(1); // 通过框架获取workspace的指针,GetWorkspaceSizes入参为所需workspace的块数。当前限制使用一块。 | 45 | size_t *currentWorkspace = context->GetWorkspaceSizes(1); // 通过框架获取workspace的指针,GetWorkspaceSizes入参为所需workspace的块数。当前限制使用一块。 |
| 39 | currentWorkspace[0] = usrSize + sysWorkspaceSize; // 设置总的workspace的数值大小,总的workspace空间由框架来申请并管理。 | 46 | currentWorkspace[0] = usrSize + sysWorkspaceSize; // 设置总的workspace的数值大小,总的workspace空间由框架来申请并管理。 |
| 40 | ... | 47 | ... |
| 41 | } | 48 | } |
| 42 | ``` | 49 | ``` |
| 43 | - | ||
| @@ -30,6 +30,9 @@ workspace是设备侧Global Memory上的一块内存。workspace内存分为两 | |||
| 30 | // 如需要使用系统workspace需要调用GetLibApiWorkSpaceSize获取系统workspace的大小。 | 30 | // 如需要使用系统workspace需要调用GetLibApiWorkSpaceSize获取系统workspace的大小。 |
| 31 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo()); | 31 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo()); |
| 32 | uint32_t sysWorkspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); | 32 | uint32_t sysWorkspaceSize = ascendcPlatform.GetLibApiWorkSpaceSize(); |
| 33 | + if (sysWorkspaceSize == std::numeric_limits<uint32_t>::max()) { | ||
| 34 | + return ge::GRAPH_FAILED; | ||
| 35 | + } | ||
| 33 | size_t *currentWorkspace = context->GetWorkspaceSizes(1); // 通过框架获取workspace的指针,GetWorkspaceSizes入参为所需workspace的块数。当前限制使用一块。 | 36 | size_t *currentWorkspace = context->GetWorkspaceSizes(1); // 通过框架获取workspace的指针,GetWorkspaceSizes入参为所需workspace的块数。当前限制使用一块。 |
| 34 | currentWorkspace[0] = usrSize + sysWorkspaceSize; // 设置总的workspace的数值大小,总的workspace空间由框架来申请并管理。 | 37 | currentWorkspace[0] = usrSize + sysWorkspaceSize; // 设置总的workspace的数值大小,总的workspace空间由框架来申请并管理。 |
| 35 | ... | 38 | ... |
| @@ -50,4 +53,3 @@ workspace是设备侧Global Memory上的一块内存。workspace内存分为两 | |||
| 50 | - 核函数(Kernel)直调算子开发场景 | 53 | - 核函数(Kernel)直调算子开发场景 |
| 51 | 54 | ||
| 52 | 需要使用workspace空间时,建议开启编译选项[HAVE\_WORKSPACE](../kernel_direct_call_from_sample.md#li1103101565014)。host侧开发者仍需要自行申请workspace的空间,并传入。在使用Matmul核函数(Kernel)侧接口等需要系统workspace的高阶API时,设置的workspace空间大小为系统workspace和用户workspace之和。系统workspace大小可以通过PlatformAscendCManager的GetLibApiWorkSpaceSize接口获取。开启[HAVE\_WORKSPACE](../kernel_direct_call_from_sample.md#li1103101565014)后,开发者在kernel侧入参处获取的workspace为偏移了系统workspace后的用户workspace。 | 55 | 需要使用workspace空间时,建议开启编译选项[HAVE\_WORKSPACE](../kernel_direct_call_from_sample.md#li1103101565014)。host侧开发者仍需要自行申请workspace的空间,并传入。在使用Matmul核函数(Kernel)侧接口等需要系统workspace的高阶API时,设置的workspace空间大小为系统workspace和用户workspace之和。系统workspace大小可以通过PlatformAscendCManager的GetLibApiWorkSpaceSize接口获取。开启[HAVE\_WORKSPACE](../kernel_direct_call_from_sample.md#li1103101565014)后,开发者在kernel侧入参处获取的workspace为偏移了系统workspace后的用户workspace。 |
| 53 | - | ||