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

[GPU Logic Bug] SELECT <column> FROM <table> WHERE <column> BETWEEN SYMMETRIC <number> AND <column> Brings GPU Logic Bug #842

Open
qwebug opened this issue Oct 16, 2024 · 1 comment
Labels
wait for confirmation developer solved this problem, and wait for confirmation by the user

Comments

@qwebug
Copy link

qwebug commented Oct 16, 2024

Describe:

SELECT <column> FROM <table> WHERE <column> BETWEEN SYMMETRIC <number> AND <column> brings different results, when using CPU-only configurations and GPU-used configurations.

SQL with CPU-only Config:

CREATE TABLE t0(c0 INT);
CREATE TABLE t1(c0 INT) INHERITS(t0);
INSERT INTO t0(c0) VALUES(1);
INSERT INTO t1(c0) VALUES(1);
CREATE SCHEMA extensions;
CREATE EXTENSION pg_strom WITH SCHEMA extensions;
SET pg_strom.enabled=off;
SELECT t1.c0 FROM t0, t1 WHERE (t1.c0) BETWEEN SYMMETRIC (1) AND (t0.c0);

Result:

 c0 
----
  1
  1
(2 rows)

SQL with GPU-used Config:

SET pg_strom.enabled=on;
SELECT t1.c0 FROM t0, t1 WHERE (t1.c0) BETWEEN SYMMETRIC (1) AND (t0.c0);

Result:

 c0 
----
  1
(1 row)

Environment:

Pg-strom Version: commit 9765660

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

@kaigai
Copy link
Contributor

kaigai commented Oct 17, 2024

a5cd19492825a270a7f6f0fb266a0f37622fcec1 fixed the problem.

For more precise, it just avoid to add GPU-paths on the inheritanced tables because most people use table partitioning nowadays, and it covers most of use cases PG-Strom wants to cover. So, it is not a good idea to cover the traditional table inheritances also from now.

postgres=# EXPLAIN SELECT t1.c0 FROM t0, t1 WHERE (t1.c0) BETWEEN SYMMETRIC (1) AND (t0.c0);
                                                       QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
 Custom Scan (GpuJoin) on t1  (cost=102.07..103.08 rows=1 width=4)
   GPU Projection: t1.c0
   GPU Scan Quals: ((t1.c0 >= 1) OR (t1.c0 <= 1)) [rows: 1 -> 1]
   GPU Join Quals [1]: (((t1.c0 >= 1) AND (t1.c0 <= t0.c0)) OR ((t1.c0 >= t0.c0) AND (t1.c0 <= 1))) ... [nrows: 1 -> 1]
   GPU-Direct SQL: enabled (N=2,GPU0,1)
   ->  Append  (cost=0.00..2.03 rows=2 width=4)
         ->  Seq Scan on t0 t0_1  (cost=0.00..1.01 rows=1 width=4)
         ->  Seq Scan on t1 t0_2  (cost=0.00..1.01 rows=1 width=4)
(8 rows)

postgres=# SELECT t1.c0 FROM t0, t1 WHERE (t1.c0) BETWEEN SYMMETRIC (1) AND (t0.c0);
 c0
----
  1
  1
(2 rows)

@kaigai kaigai added the wait for confirmation developer solved this problem, and wait for confirmation by the user label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wait for confirmation developer solved this problem, and wait for confirmation by the user
Projects
None yet
Development

No branches or pull requests

2 participants