Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/_runs-on-nv-step1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,13 @@ jobs:
&& source ${ENV_PATH}/pt2.0_diopi \
&& python main.py --mode gen_data" \
|| ( cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1} && git clean -xdf ${GEN_DATA} && exit 1 )
source ~/Aoss_env.sh
ads-cli cp ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/diopi_test/python/cache/ s3://${Platform_ci_aoss_name}:${Platform_ci_aoss_url}@platform.aoss.cn-sh-01c.sensecoreapi-oss.cn${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/diopi_test/python/cache/
elif [[ "${GETRUNNER}" == *diopi* ]];then
ssh SH1424 """
set -e
source ${ENV_PATH}/pt2.0_diopi
cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER} && cd ${BUILD_TEST1} && cd diopi_test/python &&
srun --job-name=${GITHUB_JOB} --partition=${SLURM_PAR_V100} --time=20 --gres=gpu:1 bash -c 'python main.py --mode gen_data' \
|| ( cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1} && git clean -xdf ${GEN_DATA} && exit 1 )
source ~/Aoss_env.sh
ads-cli cp ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/diopi_test/python/cache/ s3://${Platform_ci_aoss_name}:${Platform_ci_aoss_url}@platform.aoss.cn-sh-01c.sensecoreapi-oss.cn${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/diopi_test/python/cache/
"""
else
ln -s ${GEN_DATA_PATH}/${GEN_DATA}/diopi ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/diopi_test/python/cache/
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/data-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
mkdir -p ${DATA_DIR}/source/${GEN_DATA}
rsync -a --delete ${CLUSTER_V100}:${DATA_DIR}/source/${GEN_DATA}/diopi/ ${DATA_DIR}/source/${GEN_DATA}/diopi/
"""
<<<<<<< HEAD
# ssh ${CLUSTER_ASCEND_910B} """
# mkdir -p ${DATA_DIR}/source/${GEN_DATA}
# rsync -a --delete ${CLUSTER_V100}:${DATA_DIR}/source/${GEN_DATA}/diopi/ ${DATA_DIR}/source/${GEN_DATA}/diopi/
Expand All @@ -114,4 +115,13 @@ jobs:
run: |
set -e
source ~/Aoss_env.sh
ads-cli cp s3://${Platform_ci_aoss_name}:${Platform_ci_aoss_url}@platform.aoss-internal.cn-sh-01c.sensecoreapi-oss.cn${DATA_DIR}/source/${GEN_DATA}/diopi/ ${DATA_DIR}/source/${GEN_DATA}/diopi/
ads-cli cp s3://${Platform_ci_aoss_name}:${Platform_ci_aoss_url}@platform.aoss-internal.cn-sh-01c.sensecoreapi-oss.cn${DATA_DIR}/source/${GEN_DATA}/diopi/ ${DATA_DIR}/source/${GEN_DATA}/diopi/
=======
ssh ${CLUSTER_ASCEND_910B} """
mkdir -p ${DATA_DIR}/source/${GEN_DATA}
rsync -a --delete ${CLUSTER_V100}:${DATA_DIR}/source/${GEN_DATA}/diopi/ ${DATA_DIR}/source/${GEN_DATA}/diopi/
"""
# ssh ${CLUSTER_SUPA} """
# rsync -a ${CLUSTER_V100}:${DATA_DIR}/source/${GEN_DATA}/diopi/ ${DATA_DIR}/source/${GEN_DATA}/diopi/
# """
>>>>>>> 2b566db5 ([ci]fix Ascend CI (#1275))
17 changes: 3 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,8 @@ jobs:
&& rsync -a --delete ${GITHUB_WORKSPACE}/source/ ${CLUSTER_SUPA}:${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source/ || echo "failure to connect to supa"
ssh ${CLUSTER_1424} "mkdir -p ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source" \
&& rsync -a --delete ${GITHUB_WORKSPACE}/source/ ${CLUSTER_1424}:${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source/ || echo "failure to connect to sh1424"
# ssh ${CLUSTER_ASCEND_910B} "mkdir -p ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source" \
# && rsync -a --delete ${GITHUB_WORKSPACE}/source/ ${CLUSTER_ASCEND_910B}:${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source/ || echo "failure to connect to ascend 910b"
source ~/Aoss_env.sh
ads-cli cp ${GITHUB_WORKSPACE}/source/ s3://${Platform_ci_aoss_name}:${Platform_ci_aoss_url}@platform.aoss.cn-sh-01c.sensecoreapi-oss.cn${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source/
ssh ${CLUSTER_ASCEND_910B} "mkdir -p ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source" \
&& rsync -a --delete ${GITHUB_WORKSPACE}/source/ ${CLUSTER_ASCEND_910B}:${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source/ || echo "failure to connect to ascend 910b"
# ssh ${CLUSTER_KLX} "mkdir -p ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source" \
# && rsync -a --delete ${GITHUB_WORKSPACE}/source/ ${CLUSTER_KLX}:${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source/ || echo "failure to connect to kunlunxin"

Expand Down Expand Up @@ -295,12 +293,6 @@ jobs:
needs: [Rsync]
if: ${{ contains( needs.Rsync.outputs.output, 'ASCEND' ) }}
steps:
- name: COPY Source
run: |
set -e
source ~/Aoss_env.sh
ads-cli cp s3://${Platform_ci_aoss_name}:${Platform_ci_aoss_url}@platform.aoss-internal.cn-sh-01c.sensecoreapi-oss.cn${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source/ ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source/
ads-cli --dryrun --deleteSrc cp s3://${Platform_ci_aoss_name}:${Platform_ci_aoss_url}@platform.aoss-internal.cn-sh-01c.sensecoreapi-oss.cn${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/source/ /dev/null 2>&1 >/dev/null
- name: build
run: |
set -e
Expand All @@ -327,10 +319,7 @@ jobs:
set -e
cd ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}
if [[ \"${{ needs.Rsync.outputs.output }}\" == *GENDATA* ]];then
# rsync -a ${CLUSTER_V100}:${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/${GEN_DATA}/diopi ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/diopi_test/python/cache/
source ~/Aoss_env.sh
ads-cli cp s3://${Platform_ci_aoss_name}:${Platform_ci_aoss_url}@platform.aoss-internal.cn-sh-01c.sensecoreapi-oss.cn${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/diopi_test/python/cache/ ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/diopi_test/python/cache/
ads-cli --dryrun --deleteSrc cp s3://${Platform_ci_aoss_name}:${Platform_ci_aoss_url}@platform.aoss-internal.cn-sh-01c.sensecoreapi-oss.cn${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/diopi_test/python/cache/ /dev/null 2>&1 >/dev/null
rsync -a ${CLUSTER_V100}:${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/${GEN_DATA}/diopi ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/diopi_test/python/cache/
else
ln -s ${GEN_DATA_PATH}/${GEN_DATA}/diopi ${DEEPLINK_PATH}/${GITHUB_RUN_NUMBER}/${BUILD_TEST1}/diopi_test/python/cache/
fi
Expand Down
41 changes: 41 additions & 0 deletions impl/ascend/functions/index.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* @file
* @author DeepLink
* @copyright (c) 2024, DeepLink.
*/

#include "../aclnn/adaptor.hpp"

namespace impl {
namespace ascend {

diopiError_t diopiIndexBackward(diopiContextHandle_t ctx, diopiTensorHandle_t gradInput, diopiTensorHandle_t zerosLikeInput, diopiConstTensorHandle_t* indices,
int64_t nums, diopiConstTensorHandle_t gradOutput) {
AscendTensor gradInputTensor(gradInput);
AscendTensor gradOutputTensor(gradOutput);
if (gradInputTensor.numel() == 0 || gradOutputTensor.numel() == 0) {
return diopiSuccess;
}

std::vector<diopiConstTensorHandle_t> indicesVec;
indicesVec.reserve(nums);

for (int i = 0; i < nums; i++) {
if (indices[i] != nullptr) {
indicesVec.emplace_back(indices[i]);
} else {
int64_t array[1] = {0};
diopiSize_t size = {array, 1};
diopiTensorHandle_t emptyTensor = nullptr;
diopiRequireTensor(ctx, &emptyTensor, &size, nullptr, gradOutputTensor.dtype(), diopi_device);
indicesVec.emplace_back(emptyTensor);
}
}

DIOPI_ASCEND_CALL_ACLNN(aclnnInplaceCopy, ctx, gradInput, zerosLikeInput);
DIOPI_ASCEND_CALL_ACLNN(aclnnIndexPutImpl, ctx, gradInput, indicesVec, gradOutput, true, false);
return diopiSuccess;
}

} // namespace ascend
} // namespace impl
68 changes: 68 additions & 0 deletions impl/ascend/functions/index_put.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* @file
* @author DeepLink
* @copyright (c) 2024, DeepLink.
*/

#include "../aclnn/adaptor.hpp"

namespace impl {
namespace ascend {

diopiError_t diopiIndexPut(diopiContextHandle_t ctx, diopiTensorHandle_t out, diopiConstTensorHandle_t input, diopiConstTensorHandle_t values,
diopiConstTensorHandle_t* indices, int64_t indicesCounts, bool accumulate) {
AscendTensor inputTensor(input);
AscendTensor valuesTensor(values);
if (inputTensor.numel() == 0 || valuesTensor.numel() == 0) {
return diopiSuccess;
}

std::vector<diopiConstTensorHandle_t> indicesVec;
indicesVec.reserve(indicesCounts);

for (int i = 0; i < indicesCounts; i++) {
if (indices[i] != nullptr) {
indicesVec.emplace_back(indices[i]);
} else {
int64_t array[1] = {0};
diopiSize_t size = {array, 1};
diopiTensorHandle_t emptyTensor = nullptr;
diopiRequireTensor(ctx, &emptyTensor, &size, nullptr, inputTensor.dtype(), diopi_device);
indicesVec.emplace_back(emptyTensor);
}
}

DIOPI_ASCEND_CALL_ACLNN(aclnnInplaceCopy, ctx, out, input);
DIOPI_ASCEND_CALL_ACLNN(aclnnIndexPutImpl, ctx, out, indicesVec, values, accumulate, false);
return diopiSuccess;
}

diopiError_t diopiIndexPutInp(diopiContextHandle_t ctx, diopiTensorHandle_t input, diopiConstTensorHandle_t values, diopiConstTensorHandle_t* indices,
int64_t indicesCounts, bool accumulate) {
AscendTensor inputTensor(input);
AscendTensor valuesTensor(values);
if (inputTensor.numel() == 0 || valuesTensor.numel() == 0) {
return diopiSuccess;
}

std::vector<diopiConstTensorHandle_t> indicesVec;
indicesVec.reserve(indicesCounts);

for (int i = 0; i < indicesCounts; i++) {
if (indices[i] != nullptr) {
indicesVec.emplace_back(indices[i]);
} else {
int64_t array[1] = {0};
diopiSize_t size = {array, 1};
diopiTensorHandle_t emptyTensor = nullptr;
diopiRequireTensor(ctx, &emptyTensor, &size, nullptr, inputTensor.dtype(), diopi_device);
indicesVec.emplace_back(emptyTensor);
}
}

DIOPI_ASCEND_CALL_ACLNN(aclnnIndexPutImpl, ctx, input, indicesVec, values, accumulate, false);
return diopiSuccess;
}

} // namespace ascend
} // namespace impl
2 changes: 2 additions & 0 deletions impl/ascend_npu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ set(OLD_IMPL_SRC
${OLD_IMPL_DIR}/functions/arange.cpp
${OLD_IMPL_DIR}/functions/gather.cpp
${OLD_IMPL_DIR}/functions/layer_norm.cpp
${OLD_IMPL_DIR}/functions/index.cpp
${OLD_IMPL_DIR}/functions/index_put.cpp
${OLD_IMPL_DIR}/functions/index_select.cpp
${OLD_IMPL_DIR}/functions/repeat.cpp
${OLD_IMPL_DIR}/functions/group_norm.cpp
Expand Down
6 changes: 3 additions & 3 deletions impl/ascend_npu/ascend_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ ascend:
- diopiHardtanh
- diopiHardtanhBackward
- diopiHardtanhInp
- diopiIndexBackward
- diopiIndexPut
- diopiIndexPutInp
- diopiIsNan
- diopiIndexSelect
- diopiIndexSelectBackward
Expand Down Expand Up @@ -244,10 +247,7 @@ ascend:
- diopiZeros
ascend_npu:
- diopiCopyInp
- diopiIndexPut
- diopiIndexPutInp
- diopiIndex
- diopiIndexBackward
- diopiDestIndexCopyKV
- diopiTokenAttentionInference
- diopiTokenSoftmaxReduceVInference
Expand Down