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

expression: support for testing a single vectorized evaluation function #12153

Merged
merged 25 commits into from
Sep 18, 2019
Merged
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a03d446
Modify the vec expression test framework
Reminiscent Sep 10, 2019
2aa3a87
Modify the vec expression benchmark framework
Reminiscent Sep 10, 2019
0a588f4
fixup
Reminiscent Sep 10, 2019
3246ac3
fixup
Reminiscent Sep 10, 2019
abcfb5b
fixup
Reminiscent Sep 10, 2019
a7333f4
Merge branch 'master' into TestFramework
sre-bot Sep 10, 2019
de45bb7
Merge branch 'master' of https://github.com/pingcap/tidb into TestFra…
Reminiscent Sep 10, 2019
0d9afe8
Merge branch 'master' of https://github.com/pingcap/tidb into TestFra…
Reminiscent Sep 10, 2019
eb509be
Merge branch 'master' of https://github.com/pingcap/tidb into TestFra…
Reminiscent Sep 11, 2019
9d95451
Support for testing a single vectorized expression evaluation functio…
Reminiscent Sep 11, 2019
ad196a3
fixup
Reminiscent Sep 11, 2019
2df05d7
Merge branch 'master' of https://github.com/pingcap/tidb into TestFra…
Reminiscent Sep 16, 2019
b57a223
fixup
Reminiscent Sep 16, 2019
96ace68
Merge remote-tracking branch 'origin/TestFramework' into TestFramework
Reminiscent Sep 16, 2019
bfe8701
fixup
Reminiscent Sep 16, 2019
831d1c5
fixup
Reminiscent Sep 16, 2019
0ad0332
fixup
Reminiscent Sep 16, 2019
4b9c33c
fixup
Reminiscent Sep 16, 2019
047577e
Merge branch 'master' of https://github.com/pingcap/tidb into TestFra…
Reminiscent Sep 16, 2019
2162092
fixup
Reminiscent Sep 16, 2019
76dc9a5
fixup
Reminiscent Sep 17, 2019
0c83898
Merge branch 'master' into TestFramework
Reminiscent Sep 17, 2019
cbb84f0
Merge branch 'master' of https://github.com/pingcap/tidb into TestFra…
Reminiscent Sep 18, 2019
34dd594
fixup
Reminiscent Sep 18, 2019
04ddbe1
Merge branch 'master' into TestFramework
sre-bot Sep 18, 2019
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
38 changes: 34 additions & 4 deletions expression/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package expression
// This file contains benchmarks of our expression evaluation.

import (
"flag"
"fmt"
"math/rand"
"reflect"
Expand Down Expand Up @@ -394,7 +395,7 @@ func genVecExprBenchCase(ctx sessionctx.Context, funcName string, testCase vecEx
return expr, input, output
}

// testVectorizedEvalOneVec is used to verify that the special vectorized
// testVectorizedEvalOneVec is used to verify that the vectorized
// expression is evaluated correctly during projection
func testVectorizedEvalOneVec(c *C, vecExprCases vecExprBenchCases) {
ctx := mock.NewContext()
Expand Down Expand Up @@ -442,7 +443,7 @@ func testVectorizedEvalOneVec(c *C, vecExprCases vecExprBenchCases) {
}

// benchmarkVectorizedEvalOneVec is used to get the effect of
// using the special vectorized expression evaluations during projection
// using the vectorized expression evaluations during projection
func benchmarkVectorizedEvalOneVec(b *testing.B, vecExprCases vecExprBenchCases) {
ctx := mock.NewContext()
for funcName, testCases := range vecExprCases {
Expand Down Expand Up @@ -520,13 +521,29 @@ func genVecBuiltinFuncBenchCase(ctx sessionctx.Context, funcName string, testCas
return baseFunc, input, result
}

// testVectorizedBuiltinFunc is used to verify that the special vectorized
// testVectorizedBuiltinFunc is used to verify that the vectorized
// expression is evaluated correctly
func testVectorizedBuiltinFunc(c *C, vecExprCases vecExprBenchCases) {
flag.Parse()
Reminiscent marked this conversation as resolved.
Show resolved Hide resolved
var testFunc map[string]bool
testFunc = make(map[string]bool)
Reminiscent marked this conversation as resolved.
Show resolved Hide resolved
argList := flag.Args()
testAll := len(argList) > 0
for _, arg := range argList {
testFunc[arg] = true
}
for funcName, testCases := range vecExprCases {
for _, testCase := range testCases {
ctx := mock.NewContext()
baseFunc, input, output := genVecBuiltinFuncBenchCase(ctx, funcName, testCase)
baseFuncName := fmt.Sprintf("%v", reflect.TypeOf(baseFunc))
tmp := strings.Split(baseFuncName, ".")
baseFuncName = tmp[len(tmp)-1]

if !testAll && testFunc[baseFuncName] != true {
continue
}

it := chunk.NewIterator4Chunk(input)
i := 0
var vecWarnCnt uint16
Expand Down Expand Up @@ -645,16 +662,29 @@ func testVectorizedBuiltinFunc(c *C, vecExprCases vecExprBenchCases) {
}

// benchmarkVectorizedBuiltinFunc is used to get the effect of
// using the special vectorized expression evaluations
// using the vectorized expression evaluations
func benchmarkVectorizedBuiltinFunc(b *testing.B, vecExprCases vecExprBenchCases) {
ctx := mock.NewContext()

flag.Parse()
Reminiscent marked this conversation as resolved.
Show resolved Hide resolved
var testFunc map[string]bool
testFunc = make(map[string]bool)
Reminiscent marked this conversation as resolved.
Show resolved Hide resolved
argList := flag.Args()
testAll := len(argList) > 0
for _, arg := range argList {
testFunc[arg] = true
}
for funcName, testCases := range vecExprCases {
for _, testCase := range testCases {
baseFunc, input, output := genVecBuiltinFuncBenchCase(ctx, funcName, testCase)
baseFuncName := fmt.Sprintf("%v", reflect.TypeOf(baseFunc))
tmp := strings.Split(baseFuncName, ".")
baseFuncName = tmp[len(tmp)-1]

if !testAll && testFunc[baseFuncName] != true {
continue
}

b.Run(baseFuncName+"-VecBuiltinFunc", func(b *testing.B) {
b.ResetTimer()
switch testCase.retEvalType {
Expand Down