已开启
ACL_ACLGRAPH_PATH_0002用例问题 #17
guo-yanjun创建于 15 天前
guo-yanjun
15 天前 评论:
15 天前 评论:
guo-yanjun
15 天前 评论:
15 天前 评论:
guo-yanjun
15 天前 评论:
15 天前 评论:
./rtstest_host rts_acl_aclgraph_path_0002 NUM_THR=100 STREAM_FLAG=6 STREAM_NUM=9 FAULT_STOP=1 CAPTURE_METHOD=1 NUM_TASK=2048 AICORE_TYPE=5 CAPTURE_MODE_1=2 INTF_TYPE=0 NUM_LOOP=10 TASKUPDATE_TYPE=0 DEVID=9 报错的用例参数是这样的


guo-yanjun
15 天前 评论:
15 天前 评论:
guo-yanjun
13 天前 评论:
13 天前 评论:
./rtstest_host rts_acl_aclgraph_path_0002 NUM_THR=2 STREAM_FLAG=6 STREAM_NUM=9 FAULT_STOP=1 CAPTURE_METHOD=1 NUM_TASK=20 AICORE_TYPE=5 CAPTURE_MODE_1=2 INTF_TYPE=0 NUM_LOOP=10 TASKUPDATE_TYPE=0 DEVID=9


guo-yanjun
13 天前 评论:
13 天前 评论:
guo-yanjun
13 天前 评论:
13 天前 评论:
已核对 GitCode v5 官方接口并在当前PR完成实际验证:行内评论接口只要求传入 body/path/position,无需客户端携带 base/start/head。使用当前 post_pr_inline_comment.py 在 pr-review.md:216 发布测试评论后,GitCode 正确创建了 DiffNote,文件、行号及服务端自动补齐的三个 diff refs 均与当前 patchset 一致,未出现降级为普通评论或错挂,测试评论当前已删除。


#include "common.h"
#include "../api/acl/feature_aclrt.hpp"
#include "testcase.h"
#include
#include
enum AclgraphGenLaunchType {
LAUNCH_ARGS_ARRAY = 0,
LAUNCH_HOST_ARGS_2P,
LAUNCH_HOST_ARGS_3P,
LAUNCH_HOST_ARGS_RAW,
LAUNCH_FUSION,
};
static const uint32_t ACLGRAPH_GEN_MAX_OPS = 10;
struct AclgraphGenKernelInit {
uint32_t aicoreType;
uint32_t blockDim;
uint64_t sizeAic;
uint32_t argsSize;
uint32_t initData;
uint32_t expectData;
bool hasDataCheck;
AclgraphGenLaunchType launchType;
TcAclKernel knl;
TcAclMemory mem;
TcAclBase base;
aclrtFuncHandle funcHandle;
aclrtBinHandle binhandle;
aclrtBinaryLoadOptions optionalCfg;
aclrtBinaryLoadOption options[1];
aclrtLaunchKernelAttr attrs[2];
aclrtLaunchKernelCfg launchCfg;
Ascendc_AddCustomTilingData_t tiling;
void *workspace;
void *tilingDevice;
void *argsArray[5];
uint32_t *argsHost[4];
uint8_t *aDevice;
uint8_t *bDevice;
uint8_t *biasDevice;
uint8_t *cDevice;
size_t sizeA;
size_t sizeB;
size_t sizeBias;
size_t sizeC;
TcSink sink;
rtFunsionTaskInfo_t fusionInfo;
rtLaunchConfig_t fusionLaunchCfg;
rtLaunchAttribute_t fusionAttrs[1];
};
// Override parameters for TaskUpdate: when non-null, the corresponding flag
// transforms the original kInit value during aclgraphGenLaunchKernel.
// Uses relative transforms (divisor/multiplier) so they work per-op regardless
// of each op's individual blockDim/argsSize.
// type=2 (change address) uses newDevAddrIn/Out arrays indexed by opIdx % count.
struct AclgraphGenLaunchOverride {
bool halveBlockDim = false; // launch with kInit.blockDim / 2
bool doubleArgsSize = false; // launch with kInit.argsSize * 2
bool overrideDevAddr = false; // launch with newDevAddrs[opIdx % count]
void **newDevAddrIn = nullptr; // array[count]
void *newDevAddrOut = nullptr; // array[count]
// Per-op argsHost override for LAUNCH_HOST_ARGS_RAW path.
// newArgsHost[k] is a uint32_t[4] allocated by the caller.
bool overrideArgsHost = false;
uint32_t *(newArgsHost)[4] = nullptr; // points to array of uint32_t[4]
uint32_t count = 0;
};
static void aclgraphGenInitKernel(AclgraphGenKernelInit &kInit, uint32_t opType)
{
kInit.aicoreType = opType;
kInit.funcHandle = nullptr;
kInit.binhandle = nullptr;
kInit.workspace = nullptr;
kInit.tilingDevice = nullptr;
kInit.blockDim = 1;
kInit.sizeAic = 0;
kInit.argsSize = 0;
kInit.initData = 0;
kInit.expectData = 0;
kInit.hasDataCheck = false;
kInit.launchType = LAUNCH_ARGS_ARRAY;
kInit.aDevice = nullptr;
kInit.bDevice = nullptr;
kInit.biasDevice = nullptr;
kInit.cDevice = nullptr;
kInit.sizeA = 0;
kInit.sizeB = 0;
kInit.sizeBias = 0;
kInit.sizeC = 0;
kInit.optionalCfg.numOpt = 1;
kInit.options[0].type = ACL_RT_BINARY_LOAD_OPT_MAGIC;
kInit.optionalCfg.options = kInit.options;
kInit.launchCfg.numAttrs = 1;
kInit.launchCfg.attrs = kInit.attrs;
}
struct AclgraphGenKernelSet {
AclgraphGenKernelInit ops[ACLGRAPH_GEN_MAX_OPS];
uint32_t count;
};
static void aclgraphGenInitKernelSet(AclgraphGenKernelSet &kSet)
{
kSet.count = 0;
if (Global_aicore_type == 99) {
bool isDavid = (Global_SocVersion == SOCType_ASCEND910D || Global_SocVersion == SOCType_ASCEND910_96);
for (uint32_t t = 0; t <= 8; t++) {
if (t == 3 || t == 4) {
if (!isDavid) { continue; }
}
aclgraphGenInitKernel(kSet.ops[kSet.count], t);
if (kSet.ops[kSet.count].funcHandle != nullptr) {
kSet.count++;
}
}
} else {
aclgraphGenInitKernel(kSet.ops[0], Global_aicore_type);
kSet.count = 1;
}
}
static void aclgraphTaskUpdateInitKernelSet(AclgraphGenKernelSet &kSet)
{
kSet.count = 0;
bool isDavid = (Global_SocVersion == SOCType_ASCEND910D || Global_SocVersion == SOCType_ASCEND910_96);
uint32_t allowedTypes[] = {2, 4, 5, 7, 9};
if (Global_aicore_type == 99) {
for (uint32_t i = 0; i < sizeof(allowedTypes) / sizeof(allowedTypes[0]); i++) {
uint32_t t = allowedTypes[i];
if (t == 4 && !isDavid) { continue; }
if (t == 9 && !isDavid) { continue; }
aclgraphGenInitKernel(kSet.ops[kSet.count], t);
if (kSet.ops[kSet.count].funcHandle != nullptr) {
kSet.count++;
}
}
} else {
uint32_t t = Global_aicore_type;
if ((t == 4 || t == 9) && !isDavid) {
RTS_SLOG("RTS_ACL_ACLGRAPH_PATH_0002", "aicore_type=%u not supported on this platform, skip", t);
} else {
aclgraphGenInitKernel(kSet.ops[kSet.count], t);
if (kSet.ops[kSet.count].funcHandle != nullptr) {
kSet.count++;
}
}
}
}
static void aclgraphGenSyncStream(TcAclStream &strm, TcAclDevice &dev)
{
if (Global_intf_type == 1) {
RUN_API(strm.testAclrtSynchronizeStreamWithTimeout(strm.stream, -1));
} else {
RUN_API(strm.testAclrtSynchronizeStream());
}
}
static void aclgraphGenLaunchKernel(AclgraphGenKernelInit &kInit, aclrtStream stream, uint32_t opIdx,
const AclgraphGenLaunchOverride *ovrd = nullptr)
{
uint32_t blockDim = kInit.blockDim;
uint32_t argsSize = kInit.argsSize;
void *devAddrIn = (void *)kInit.mem.devAddrIn;
void *devAddrOut = (void *)kInit.mem.devAddrOut;
}
static void aclgraphGenLaunchKernelSet(AclgraphGenKernelSet &kSet, uint32_t opIdx, aclrtStream stream,
const AclgraphGenLaunchOverride *ovrd = nullptr)
{
aclgraphGenLaunchKernel(kSet.ops[opIdx % kSet.count], stream, opIdx, ovrd);
}
static void testAclgraphGeneralizeThread(TcAclContext *ctx, AclgraphGenKernelSet *kSet)
{
RUN_API(ctx->testAclrtSetCurrentContext(ctx->context));
TcAclModel mdl;
TcAclDevice dev(0, 0, 0);
}
TEST_F(RTS, ACL_ACLGRAPH_PATH_0001)
{
if (Global_ChipType != Chip_MILAN) { return; }
RTS_EVENTLOG("multi-thread generalize: each thread independent capture model lifecycle");
}
static void testAclgraphTaskUpdateThread(TcAclContext *ctx, AclgraphGenKernelSet *kSet)
{
RUN_API(ctx->testAclrtSetCurrentContext(ctx->context));
TcAclModel mdl;
TcAclDevice dev(0, 0, 0);
}
TEST_F(RTS, ACL_ACLGRAPH_PATH_0002)
{
if (Global_ChipType != Chip_MILAN) { return; }
RTS_EVENTLOG("task update generalize: capture TaskGrp -> TaskUpdate -> execute");
}