Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improvement](bitshuffle)Enable avx512 support in bitshuffle for performance boost #15972

Merged
merged 1 commit into from
Jan 30, 2023

Conversation

HackToday
Copy link
Contributor

@HackToday HackToday commented Jan 16, 2023

Signed-off-by: Wu, Kaiqiang kaiqiang.wu@intel.com
Co-authored-by: vesslanjin jun.i.jin@intel.com

Proposed changes

Issue Number: close #xxx

Problem summary

As AVX512 is available in most modern processors, it is good to use them if have performance boost.
In latest bitshuffle, AVX512 have been added. We could make it integrated in doris for AVX512 case.

Tested with master branch, queries(SSB query q1.1.sql~q4.3.sql total 13 queries) can be boost from 1.4%~3.2%. (use run-ssb-queries.sh 5 times, each time with 100 iterations.)

Checklist(Required)

  1. Does it affect the original behavior:
    • Yes
    • No
    • I don't know
  2. Has unit tests been added:
    • Yes
    • No
    • No Need
  3. Has document been added or modified:
    • Yes
    • No
    • No Need
  4. Does it need to update dependencies:
    • Yes
    • No
  5. Are there any changes that cannot be rolled back:
    • Yes (If Yes, please explain WHY)
    • No

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@github-actions
Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck ' returned error 1 finding the following syntactical issues:

----------

In thirdparty/build-thirdparty.sh line 1055:
	if [ "$arch" == "avx512" ]; then
           ^---------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh.
              ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
	if [[ "${arch}" == "avx512" ]]; then


In thirdparty/build-thirdparty.sh line 1083:
        elif [ "$arch" == "avx512" ]; then
             ^---------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh.
                ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
        elif [[ "${arch}" == "avx512" ]]; then


In thirdparty/build-thirdparty.sh line 1085:
            "${DORIS_BIN_UTILS}/nm" --defined-only --extern-only $tmp_obj | while read -r addr type sym ; do
                                                                 ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                 ^------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
            "${DORIS_BIN_UTILS}/nm" --defined-only --extern-only "$tmp_obj" | while read -r addr type sym ; do


In thirdparty/build-thirdparty.sh line 1086:
                echo ${sym} ${sym}_${arch}
                     ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                            ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                   ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
                echo "${sym}" "${sym}"_"${arch}"


In thirdparty/build-thirdparty.sh line 1088:
            "${DORIS_BIN_UTILS}/objcopy" --redefine-syms=renames.txt $tmp_obj $dst_obj
                                                                     ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                     ^------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.
                                                                              ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                              ^------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
            "${DORIS_BIN_UTILS}/objcopy" --redefine-syms=renames.txt "$tmp_obj" $dst_obj

For more information:
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
  https://www.shellcheck.net/wiki/SC2250 -- Prefer putting braces around vari...
  https://www.shellcheck.net/wiki/SC2292 -- Prefer [[ ]] over [ ] for tests i...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors

'shfmt ' returned error 1 finding the following formatting issues:

----------
--- thirdparty/build-thirdparty.sh.orig
+++ thirdparty/build-thirdparty.sh
@@ -1052,8 +1052,8 @@
         if [[ "${arch}" == "avx2" ]]; then
             arch_flag="-mavx2"
         fi
-	if [ "$arch" == "avx512" ]; then
-           arch_flag="-mavx512bw -mavx512f"
+        if [ "$arch" == "avx512" ]; then
+            arch_flag="-mavx512bw -mavx512f"
         fi
         tmp_obj="bitshuffle_${arch}_tmp.o"
         dst_obj="bitshuffle_${arch}.o"
@@ -1082,9 +1082,9 @@
             "${objcopy}" --redefine-syms=renames.txt "${tmp_obj}" "${dst_obj}"
         elif [ "$arch" == "avx512" ]; then
             # Create a mapping file with '<old_sym> <suffixed_sym>' on each line.
-            "${DORIS_BIN_UTILS}/nm" --defined-only --extern-only $tmp_obj | while read -r addr type sym ; do
+            "${DORIS_BIN_UTILS}/nm" --defined-only --extern-only $tmp_obj | while read -r addr type sym; do
                 echo ${sym} ${sym}_${arch}
-            done > renames.txt
+            done >renames.txt
             "${DORIS_BIN_UTILS}/objcopy" --redefine-syms=renames.txt $tmp_obj $dst_obj
         else
             mv "${tmp_obj}" "${dst_obj}"
----------

You can reformat the above files to meet shfmt's requirements by typing:

  shfmt  -w filename


Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@github-actions
Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck ' returned error 1 finding the following syntactical issues:

----------

In thirdparty/build-thirdparty.sh line 1055:
	if [ "$arch" == "avx512" ]; then
           ^---------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh.
              ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
	if [[ "${arch}" == "avx512" ]]; then

For more information:
  https://www.shellcheck.net/wiki/SC2250 -- Prefer putting braces around vari...
  https://www.shellcheck.net/wiki/SC2292 -- Prefer [[ ]] over [ ] for tests i...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors

'shfmt ' returned error 1 finding the following formatting issues:

----------
--- thirdparty/build-thirdparty.sh.orig
+++ thirdparty/build-thirdparty.sh
@@ -1052,8 +1052,8 @@
         if [[ "${arch}" == "avx2" ]]; then
             arch_flag="-mavx2"
         fi
-	if [ "$arch" == "avx512" ]; then
-           arch_flag="-mavx512bw -mavx512f"
+        if [ "$arch" == "avx512" ]; then
+            arch_flag="-mavx512bw -mavx512f"
         fi
         tmp_obj="bitshuffle_${arch}_tmp.o"
         dst_obj="bitshuffle_${arch}.o"
----------

You can reformat the above files to meet shfmt's requirements by typing:

  shfmt  -w filename


@github-actions
Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck ' returned error 1 finding the following syntactical issues:

----------

In thirdparty/build-thirdparty.sh line 1055:
        if [ "$arch" == "avx512" ]; then
           ^---------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh.
              ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
        if [[ "${arch}" == "avx512" ]]; then

For more information:
  https://www.shellcheck.net/wiki/SC2250 -- Prefer putting braces around vari...
  https://www.shellcheck.net/wiki/SC2292 -- Prefer [[ ]] over [ ] for tests i...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors
'shfmt ' found no issues.

@github-actions
Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck ' returned error 1 finding the following syntactical issues:

----------

In thirdparty/build-thirdparty.sh line 1055:
        if [[ "$arch" == "avx512" ]]; then
               ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.

Did you mean: 
        if [[ "${arch}" == "avx512" ]]; then

For more information:
  https://www.shellcheck.net/wiki/SC2250 -- Prefer putting braces around vari...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors
'shfmt ' found no issues.

@HackToday
Copy link
Contributor Author

@morningman Could you help make the workflow run ? It seems need maintainers' approval

@adonis0147
Copy link
Contributor

@morningman Could you help make the workflow run ? It seems need maintainers' approval

Done.

@adonis0147
Copy link
Contributor

adonis0147 commented Jan 16, 2023

Hi @HackToday , thanks for your contribution. Some workflows failed because we didn't build the third-party libraries in workflow. We fetched the docker image of pre-built third-party libraries and built the project against the libraries.

In order to fix these checks, you should split this pull request into two pieces. One is for upgrading the package bitshuffle and another is for the modification of BE.

@HackToday
Copy link
Contributor Author

HackToday commented Jan 16, 2023

Hi @adonis0147 do you mean two separate PRs ? One PR for upgrading bitshuffle, and another for changing BE (until first PR merged)?
Thanks

@adonis0147
Copy link
Contributor

Hi @adonis0147 do you mean two separate PRs ? One PR for upgrading bitshuffle, and another for changing BE (until first PR merged)? Thanks

Yes.

@HackToday
Copy link
Contributor Author

@adonis0147 The first split PR is here: #15993

adonis0147 pushed a commit that referenced this pull request Jan 17, 2023
@HackToday
Copy link
Contributor Author

@adonis0147 hi, I am not sure the difference in Doris github run vs host run.

In my local env, I can build and run ut successfully.

The attached file is ut run in my local host.

run-ut-test.txt

but doris github in teamcity would complain with error

http://43.132.222.7:8111/viewLog.html?buildId=82706&buildTypeId=Doris_DorisBeUt_BeUt&tab=buildLog&_focus=260

@adonis0147
Copy link
Contributor

@adonis0147 hi, I am not sure the difference in Doris github run vs host run.

In my local env, I can build and run ut successfully.

The attached file is ut run in my local host.

run-ut-test.txt

but doris github in teamcity would complain with error

http://43.132.222.7:8111/viewLog.html?buildId=82706&buildTypeId=Doris_DorisBeUt_BeUt&tab=buildLog&_focus=260

Hi @HackToday , sorry to confuse you. The source of the pre-built third-party libraries which GitHub workflows use differs from the one TeamCity workflows use.

GitHub workflows use the pre-built third-party libraries from Apache Doris Third Party Prebuilt and these libraries are up to date. However, TeamCity workflows use ones from the Docker image apache/doris:build-env-ldb-toolchain-latest and they are obsolete now. That is the reason why your checks failed.

In short, just wait patiently and I will let you re-trigger all these checks when everything is ready.

By the way, would you like resolve the previous comments?

@HackToday
Copy link
Contributor Author

hi @adonis0147 Have resolved. Please help check. Thanks.

@adonis0147
Copy link
Contributor

Hi @HackToday , the Docker image has been updated. Please rebase the branch on master to re-trigger the checks.

@hello-stephen
Copy link
Contributor

hello-stephen commented Jan 29, 2023

TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 34.9 seconds
load time: 524 seconds
storage size: 17122602409 Bytes
https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20230129092056_clickbench_pr_86118.html

@HackToday
Copy link
Contributor Author

hi @adonis0147 Have rebased. Not quite sure the Po regression failed reason:
http://43.132.222.7:8111/viewLog.html?buildId=85876&tab=buildResultsDiv&buildTypeId=Doris_DorisRegression_P0Regression#testNameId-4553081828222454766

Caused by: java.lang.AssertionError: Expect exception msg contains 'null', but meet 'java.sql.SQLException: errCode = 2, detailMessage = There is no scanNode Backend available.[10003: not alive]'

It seems not related. How to rerun the P0 case or something else ?

@adonis0147
Copy link
Contributor

adonis0147 commented Jan 29, 2023

hi @adonis0147 Have rebased. Not quite sure the Po regression failed reason: http://43.132.222.7:8111/viewLog.html?buildId=85876&tab=buildResultsDiv&buildTypeId=Doris_DorisRegression_P0Regression#testNameId-4553081828222454766

Caused by: java.lang.AssertionError: Expect exception msg contains 'null', but meet 'java.sql.SQLException: errCode = 2, detailMessage = There is no scanNode Backend available.[10003: not alive]'

It seems not related. How to rerun the P0 case or something else ?

Hi @HackToday , these errors indicated that the workflow built the codebase successfully, but some cases failed. They are irrelevant to this PR and we are resolving them now.

@adonis0147
Copy link
Contributor

Hi @HackToday , it seems that we have resolved the issues with the workflows. Please rebase the branch on the latest master to trigger the checks again.

…ormance boost

Signed-off-by: Wu, Kaiqiang <kaiqiang.wu@intel.com>
Co-authored-by: vesslanjin <jun.i.jin@intel.com>
Copy link
Contributor

@adonis0147 adonis0147 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jan 29, 2023
@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@adonis0147 adonis0147 merged commit 28fcc09 into apache:master Jan 30, 2023
dutyu pushed a commit to dutyu/doris that referenced this pull request Feb 1, 2023
dutyu pushed a commit to dutyu/doris that referenced this pull request Feb 1, 2023
…ormance boost (apache#15972)

As AVX512 is available in most modern processors, it is good to use them if have performance boost.
In latest bitshuffle, AVX512 have been added. We could make it integrated in doris for AVX512 case.

Tested with master branch, queries(SSB query q1.1.sql~q4.3.sql total 13 queries) can be boost from 1.4%~3.2%. (use run-ssb-queries.sh 5 times, each time with 100 iterations.)

Signed-off-by: Wu, Kaiqiang <kaiqiang.wu@intel.com>
Co-authored-by: vesslanjin <jun.i.jin@intel.com>
dutyu pushed a commit to dutyu/doris that referenced this pull request Feb 6, 2023
…ormance boost (apache#15972)

As AVX512 is available in most modern processors, it is good to use them if have performance boost.
In latest bitshuffle, AVX512 have been added. We could make it integrated in doris for AVX512 case.

Tested with master branch, queries(SSB query q1.1.sql~q4.3.sql total 13 queries) can be boost from 1.4%~3.2%. (use run-ssb-queries.sh 5 times, each time with 100 iterations.)

Signed-off-by: Wu, Kaiqiang <kaiqiang.wu@intel.com>
Co-authored-by: vesslanjin <jun.i.jin@intel.com>
@xiaokang
Copy link
Contributor

@HackToday A avx512 related bug #24145 is reported. Would you analyse and fix this problem?

@xiaokang
Copy link
Contributor

Revert this PR and wait for further fix.

zy-kkk pushed a commit that referenced this pull request Sep 10, 2023
xiaokang added a commit that referenced this pull request Sep 10, 2023
@HackToday
Copy link
Contributor Author

@xiaokang sure, I have leave comment on the issue. I would double check if arch special issue or something else. Thanks

@HackToday
Copy link
Contributor Author

@xiaokang please help leave your comment on the issue (#24145) for some questions. Thanks

luozenglin pushed a commit to luozenglin/incubator-doris that referenced this pull request Sep 13, 2023
…ormance boost (apache#15972)

As AVX512 is available in most modern processors, it is good to use them if have performance boost.
In latest bitshuffle, AVX512 have been added. We could make it integrated in doris for AVX512 case.

Tested with master branch, queries(SSB query q1.1.sql~q4.3.sql total 13 queries) can be boost from 1.4%~3.2%. (use run-ssb-queries.sh 5 times, each time with 100 iterations.)

Signed-off-by: Wu, Kaiqiang <kaiqiang.wu@intel.com>
Co-authored-by: vesslanjin <jun.i.jin@intel.com>
Change-Id: Iec7a7e6640ef9c3873b3f966e9c7f42d25d2e73e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants