heterodb / pg-strom

PG-Strom - Master development repository
http://heterodb.github.io/pg-strom/
Other
1.27k stars 163 forks source link

[GPU Logic Bug] SELECT <column> FROM <table> WHERE <conditon> Brings GPU Logic Bug #783

Closed qwebug closed 2 weeks ago

qwebug commented 3 weeks ago

Describe:

SELECT \ FROM \

WHERE \ brings different results, when using CPU-only configurations and GPU-used configurations.

SQL with CPU-only Config:

CREATE TABLE t0(c0 CHAR(486));
CREATE TABLE t1(LIKE t0);
CREATE TABLE t2(LIKE t1);
INSERT INTO t0(c0) VALUES(0);
INSERT INTO t1(c0) VALUES('\nK');
INSERT INTO t2(c0) VALUES('Y+'), (0);
CREATE SCHEMA extensions;
CREATE EXTENSION pg_strom WITH SCHEMA extensions;
SET pg_strom.enabled=off;
SELECT t1.c0, t2.c0 FROM t1, t2, t0 WHERE ((t2.c0)IS DISTINCT FROM(t1.c0));

Result:

                                                                                                                                                                                                                                                   c0                                                                                                                                                                                                                                                   |                                                                                                                                                                                                                                                   c0                                                                                                                                                                                                                                                   
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 \nK                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Y+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
 \nK                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | 0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
(2 rows)

SQL with GPU-used Config:

BEGIN;
SET LOCAL pg_strom.enabled=on; 
SET LOCAL pg_strom.enable_gpuscan=on; 
SET LOCAL pg_strom.enable_gpujoin=on; 
SELECT t1.c0, t2.c0 FROM t1, t2, t0 WHERE ((t2.c0)IS DISTINCT FROM(t1.c0));
COMMIT;

Result:

 c0  | c0 
-----+----
 \nK | Y+
 \nK | 0
(2 rows)

Environment:

Pg-strom Version: commit b1f04e4042a8990ee9b21263f08365982b5495b5

PostgreSQL Version: 15.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20), 64-bit

CUDA Version: 12.2

NVIDIA Driver Version: 535.171.04

qwebug commented 3 weeks ago

This problem came up at commit: https://github.com/heterodb/pg-strom/commit/b1f04e4042a8990ee9b21263f08365982b5495b5. And it has been fixed at https://github.com/heterodb/pg-strom/commit/f1da73a299e72447afd1f984d5255726071a0703, after my verification. Thanks to the developers for their contributions.