Commit e5abda1e authored by GG4mida's avatar GG4mida

refactor: improve the performance of kernel functions

parent f45322d0
...@@ -35,7 +35,7 @@ jobs: ...@@ -35,7 +35,7 @@ jobs:
with: with:
artifacts: "${{ github.workspace }}/dist/windows.zip" artifacts: "${{ github.workspace }}/dist/windows.zip"
token: ${{ secrets.GH_TOKEN }} token: ${{ secrets.GH_TOKEN }}
tag: v1.1.4 tag: v2.0.1
draft: true draft: true
allowUpdates: true allowUpdates: true
replacesArtifacts: true replacesArtifacts: true
\ No newline at end of file
# Makefile artifacts # Makefile artifacts
*.o *.o
*.so *.so
.DS_store
cache-opencl.* cache-opencl.*
bin bin
.DS_store profanity.x64
README_dev.md README_dev.md
...@@ -453,16 +453,14 @@ void profanity_result_update( ...@@ -453,16 +453,14 @@ void profanity_result_update(
const size_t id, const size_t id,
__global const uchar * const hash, __global const uchar * const hash,
__global result * const pResult, __global result * const pResult,
const uchar score,
const uchar scoreMax) const uchar scoreMax)
{ {
if (score && score > scoreMax) { uchar score = scoreMax + 1;
uchar hasResult = atomic_inc(&pResult[score].found); uchar hasResult = atomic_inc(&pResult[score].found);
if (hasResult == 0) { if (hasResult == 0) {
pResult[score].foundId = id; pResult[score].foundId = id;
for (int i = 0; i < 20; ++i) { for (int i = 0; i < 20; ++i) {
pResult[score].foundHash[i] = hash[i]; pResult[score].foundHash[i] = hash[i];
}
} }
} }
} }
...@@ -494,12 +492,11 @@ __kernel void profanity_score_matching( ...@@ -494,12 +492,11 @@ __kernel void profanity_score_matching(
} }
} }
for(uint j = 0; j < matchingCount; j++) { for(uint j = 0; j < matchingCount; j++) {
uint scorePrefix = 0; uint scorePrefix = 1;
uint scoreSuffix = 0; uint scoreSuffix = 0;
uint scoreTotal = 0;
uint dataIndex = 0; uint dataIndex = 0;
if(prefixCount > 0) { if(prefixCount > 1) {
for (uint i = 0; i < 10; ++i) { for (uint i = 1; i < 10; ++i) {
dataIndex = j * 20 + i; dataIndex = j * 20 + i;
if (data1[dataIndex] > 0 && (matchingHash[i] & data1[dataIndex]) == data2[dataIndex]) { if (data1[dataIndex] > 0 && (matchingHash[i] & data1[dataIndex]) == data2[dataIndex]) {
++scorePrefix; ++scorePrefix;
...@@ -519,8 +516,7 @@ __kernel void profanity_score_matching( ...@@ -519,8 +516,7 @@ __kernel void profanity_score_matching(
} }
} }
if(scorePrefix >= prefixCount && scoreSuffix >= suffixCount){ if(scorePrefix >= prefixCount && scoreSuffix >= suffixCount){
scoreTotal = scoreMax + 1; profanity_result_update(id, hash, pResult, scoreMax);
profanity_result_update(id, hash, pResult, scoreTotal, scoreMax);
break; break;
} }
} }
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment