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 <agg_func> FROM <table> JOIN <table> WHERE <conditon> GROUP BY <column> Brings GPU Logic Bug #790

Closed qwebug closed 2 weeks ago

qwebug commented 3 weeks ago

Describe:

SELECT \ FROM \

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

SQL with CPU-only Config:

CREATE TABLE t0(c0 money);
CREATE TABLE t1(LIKE t0);
INSERT INTO t1(c0) VALUES(CAST(0.9 AS MONEY)), ((-1.0E8)::MONEY), (CAST(0.1 AS MONEY));
UPDATE t0 SET c0=DEFAULT;
CREATE INDEX i0 ON t1(c0) INCLUDE(c0);
CREATE SCHEMA extensions;
CREATE EXTENSION pg_strom WITH SCHEMA extensions;
SET pg_strom.enabled=off;
SELECT BOOL_OR(FALSE) FROM t1 FULL OUTER JOIN t0 ON FALSE WHERE ((0.1)::MONEY)IS DISTINCT FROM(t0.c0) GROUP BY ((0.8)::MONEY) BETWEEN SYMMETRIC ((0.7)::MONEY) AND (t1.c0);

Result:

 bool_or 
---------
 f
 f
(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; 
SET LOCAL pg_strom.enable_gpupreagg=on; 
SELECT BOOL_OR(FALSE) FROM t1 FULL OUTER JOIN t0 ON FALSE WHERE ((0.1)::MONEY)IS DISTINCT FROM(t0.c0) GROUP BY ((0.8)::MONEY) BETWEEN SYMMETRIC ((0.7)::MONEY) AND (t1.c0);
COMMIT;

Result:

 bool_or 
---------
 f
(1 row)

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.

kaigai commented 2 weeks ago

I also could not reproduce the problem in my environment.

Thanks for your reports.