Commit 1d09e987 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'ci/complexity-measurement-2' into 'main'

[CI] Add automated complexity measurements

See merge request !501
parents f167a62f fe97a8fb
Loading
Loading
Loading
Loading
Loading
+290 −3
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ variables:
  CI_REGRESSION_THRESH_SSNR: "-1"
  CI_REGRESSION_THRESH_ODG: "-0.05"
  GIT_CLEAN_FLAGS: -ffdxq
  INSTR_DIR: "scripts/c-code_instrument"
  MANUAL_PIPELINE_TYPE:
    description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec."
    value: 'default'
@@ -37,6 +38,7 @@ variables:
      - 'evs-26444'
      - 'sanitizer-stv'
      - 'pytest-renderer'
      - 'complexity'


default:
@@ -51,7 +53,7 @@ workflow:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
      variables:
        IVAS_PIPELINE_NAME: 'MR pipeline: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME'
    ### disabled for now because pipeline setup is redundant with MR pipeline with current workflow
    ### disabled for now because pipeline cd is redundant with MR pipeline with current workflow
    # - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Pushes to main
    #   variables:
    #     IVAS_PIPELINE_NAME: 'Push pipeline: $CI_COMMIT_BRANCH'
@@ -76,6 +78,9 @@ workflow:
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-renderer'
      variables:
        IVAS_PIPELINE_NAME: 'Renderer test: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'complexity'
      variables:
        IVAS_PIPELINE_NAME: 'Complexity Measurement on $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'schedule' # Scheduled in any branch
      variables:
        IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH'        
@@ -113,6 +118,7 @@ stages:
  - mv ./IVAS_rend ./IVAS_rend_ref

  ### build test binaries
  - git restore .
  - git checkout $current_commit_sha
  - make clean
  - make -j
@@ -530,10 +536,12 @@ build-codec-linux-instrumented-make:
      when: never
  extends:
    - .build-job-linux
  timeout: "7 minutes"
  script:
    - *print-common-info
    - sed -i".bak" "s/\/\*#define WMOPS 1\*\//#define WMOPS 1/g" lib_com/count.h
    - make -j
    - *update-scripts-repo
    - bash scripts/prepare_instrumentation.sh -m MEM_ONLY -p BASOP
    - make -j -C $INSTR_DIR

# ---------------------------------------------------------------
# Short test jobs that run in merge request pipelines
@@ -900,6 +908,285 @@ ivas-pytest-renderer:
  <<: *ivas-pytest-anchor


# ---------------------------------------------------------------
# Complexity measurement jobs
# ---------------------------------------------------------------

.complexity-measurements-setup:
  &complexity-measurements-setup # create necessary environment
  ### 1. part: mainly same as in float repo - this is boilerplate code to make the gitlab pages presentation work
  - mkdir -p wmops/logs

  - job_id=$(python3 ci/get_id_of_last_job_occurence.py $CI_COMMIT_REF_NAME $CI_JOB_NAME $CI_PROJECT_ID)
  - echo $job_id
  - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$job_id/artifacts" --output artifacts.zip
  - unzip artifacts.zip || true # this may fail on first run, when there are no artifacts there and the zip file is actually just "404"-html
  - ls
  - public_dir="$CI_JOB_NAME-public"
  # if is needed to catch case when no artifact is there (first run), similarly as above
  - if [[ -d $public_dir ]]; then mv $public_dir/* wmops/;  fi
  - ls wmops
  - rm artifacts.zip
  - rm -rf $public_dir

  ### 2. part: setup specific for BASOP repo
  # hack for using the reference encoder -> need to build manually to make script use ref enc and BASOP dec
  - mkdir COMPLEXITY
  - cp IVAS_cod_ref COMPLEXITY/IVAS_cod
  # build branch code aain with instrumentation
  - make clean
  - bash scripts/prepare_instrumentation.sh -p BASOP -m MEM_ONLY
  - make -j -C $INSTR_DIR
  - cp $INSTR_DIR/IVAS_dec COMPLEXITY/IVAS_dec

.complexity-measurements-prepare-artifacts:
  &complexity-measurements-prepare-artifacts # prepare artifacts -> move to public directory
  - public_dir="$CI_JOB_NAME-public"
  - mkdir $public_dir
  - mv -f wmops/log_*_all.txt wmops/*.js ${public_dir}/
  # move logfiles for links
  - mkdir $public_dir/logs
  # first move logs
  - log_files=$(cat $public_dir/graphs*.js | grep logFile | sed "s/.*\(wmops_newsletter_.*\.csv\).*/\1/g")
  - echo $log_files
  - ls wmops/logs
  - for f in $log_files; do [ -f wmops/logs/$f ] && mv wmops/logs/$f $public_dir/logs/$f; done
  # copy index page blueprint
  - cp ci/complexity_measurements/index_complexity.html ${public_dir}/index.html
  # patch the format in the title
  - sed -i "s/IVAS FORMAT/IVAS $in_format to $out_format/g" ${public_dir}/index.html
  # do separately here to avoid overwrite complaints by mv
  - mv -f ci/complexity_measurements/style.css ${public_dir}/
  - ls $public_dir

.complexity-template:
  extends:
    - .test-job-linux
  timeout: 3 hours 30 minutes
  stage: test
  variables:
    ret_val: 0
  before_script:
    - *print-common-info
    - *update-scripts-repo
    - *update-ltv-repo
    - *build-reference-and-dut-binaries
    - *complexity-measurements-setup
    - which coan
  artifacts:
    name: "$CI_JOB_NAME--$CI_COMMIT_REF_NAME--sha-$CI_COMMIT_SHA"
    when: always
    expire_in: 1 week
    paths:
      - $CI_JOB_NAME-public

complexity-stereo-in-stereo-out:
  extends:
    - .complexity-template
  rules:
    - if: $MEASURE_COMPLEXITY_LINUX
  script:
    - in_format=stereo
    - out_format=stereo
    - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" mem_only || ret_val=$?
    - *complexity-measurements-prepare-artifacts
    - exit $ret_val

# complexity-stereo-in-7_1_4-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#   script:
#     - in_format=stereo
#     - out_format=7_1_4
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-ism-in-ext-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 1 hours
#   script:
#     - in_format=ISM
#     - out_format=EXT
#     - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-ism-in-binaural-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 1 hours
#   script:
#     - in_format=ISM
#     - out_format=BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB
#     - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-hoa3-in-hoa3-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 2 hours
#   script:
#     - in_format=HOA3
#     - out_format=HOA3
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-hoa3-in-binaural-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 2 hours
#   script:
#     - in_format=HOA3
#     - out_format=BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-osba-in-ext-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 2 hours
#   script:
#     - in_format=OSBA
#     - out_format=EXT
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-osba-in-binaural-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 2 hours
#   script:
#     - in_format=OSBA
#     - out_format=BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-mc-in-7_1_4-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 2 hours
#   script:
#     - in_format=MC
#     - out_format=7_1_4
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-mc-in-binaural-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 2 hours
#   script:
#     - in_format=MC
#     - out_format=BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-masa-in-ext-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 2 hours
#   script:
#     - in_format=MASA
#     - out_format=EXT
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-masa-in-binaural-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 2 hours
#   script:
#     - in_format=MASA
#     - out_format="BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB"
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-omasa-in-ext-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 2 hours
#   script:
#     - in_format=OMASA
#     - out_format=EXT
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-omasa-in-binaural-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 2 hours
#   script:
#     - in_format=OMASA
#     - out_format="BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB"
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val

# complexity-StereoDmxEVS-stereo-in-mono-out:
#   extends:
#     - .complexity-template
#   rules:
#     - if: $MEASURE_COMPLEXITY_LINUX
#       # when: delayed:
#       # start_in: 2 hours
#   script:
#     - in_format=StereoDmxEVS
#     - out_format=mono
#     - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$?
#     - *complexity-measurements-prepare-artifacts
#     - exit $ret_val


# job that sets up gitlab pages website
pages:
  stage: deploy
+4 −0
Original line number Diff line number Diff line
@@ -103,6 +103,10 @@ CFLAGS += -fprofile-arcs -ftest-coverage -fprofile-update=atomic
LDFLAGS += -fprofile-arcs -ftest-coverage -fprofile-update=atomic
endif

ifeq "$(WMOPS)" "1"
CFLAGS += -DWMOPS=1
endif

ifeq "$(STRIP)" "1"
CFLAGS   += -fdata-sections -ffunction-sections
ifneq ($(UNAME_S),Darwin)
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@
#define IVAS_CNST
#define REMOVE_IVAS_UNUSED_PARAMETERS_WARNING  /*temporary operation on unused EVS parameters to remove warnings, these parameters will be used in IVAS */

#define MOD_BIT_ALLOC_ROM_TABLE   // Just to highlight modification in bit allocation table and to ensure these modifications doesn't affect EVS modes*/
#define MOD_BIT_ALLOC_ROM_TABLE   /* Just to highlight modification in bit allocation table and to ensure these modifications doesn't affect EVS modes*/
#define SIMPLIFY_CODE_BE   // Simplify synthesis loop

#define CR_2109_to_2112_cd0_ce0  /* This is related to the CRs include in the 26.444 package of 21-12. Concerns lead_deindexing and  */
+1 −1
Original line number Diff line number Diff line
@@ -498,7 +498,7 @@ void IGF_ErodeSpectrum( Word16 *highPassEner_exp, /**< ou
#else
            L_tmp = L_add( pPowerSpectrum[i], highPassEner_Ovfl );
#endif
            BASOP_SATURATE_WARNING_ON_EVS
            BASOP_SATURATE_WARNING_ON_EVS;

            IF( L_tmp < 0 )
            {