pg.ddx.io pgvector/pgvector GitHub issues and pull requests
help / color / mirror / Atom feed[pgvector/pgvector] PR #710: Optimization: added `restrict`
4+ messages / 2 participants
[nested] [flat]
* [pgvector/pgvector] PR #710: Optimization: added `restrict`
@ 2024-11-09 17:31 "ivanstepanovftw (@ivanstepanovftw)" <noreply+ivanstepanovftw@github.com>
0 siblings, 0 replies; 4+ messages in thread
From: ivanstepanovftw (@ivanstepanovftw) @ 2024-11-09 17:31 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
solves #709
inline patch 1: src/vector.c (+3/-3 lines) download inline-1.patch
diff --git a/src/vector.c b/src/vector.c
index a5b2aac36..927c56a28 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -590,7 +590,7 @@ vector_l2_squared_distance(PG_FUNCTION_ARGS)
}
VECTOR_TARGET_CLONES static float
-VectorInnerProduct(int dim, float *ax, float *bx)
+VectorInnerProduct(int dim, float *const restrict ax, float *const restrict bx)
{
float distance = 0.0;
@@ -632,7 +632,7 @@ vector_negative_inner_product(PG_FUNCTION_ARGS)
}
VECTOR_TARGET_CLONES static double
-VectorCosineSimilarity(int dim, float *ax, float *bx)
+VectorCosineSimilarity(int dim, float *const restrict ax, float *const restrict bx)
{
float similarity = 0.0;
float norma = 0.0;
@@ -708,7 +708,7 @@ vector_spherical_distance(PG_FUNCTION_ARGS)
/* Does not require FMA, but keep logic simple */
VECTOR_TARGET_CLONES static float
-VectorL1Distance(int dim, float *ax, float *bx)
+VectorL1Distance(int dim, float *const restrict ax, float *const restrict bx)
{
float distance = 0.0;
^ permalink raw [nested|flat] 4+ messages in thread
* Re: [pgvector/pgvector] PR #710: Optimization: added `restrict`
@ 2024-11-09 17:58 "ankane (@ankane)" <noreply+ankane@github.com>
2 siblings, 0 replies; 4+ messages in thread
From: ankane (@ankane) @ 2024-11-09 17:58 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Hi @ivanstepanovftw, see https://github.com/pgvector/pgvector/issues/709#issuecomment-2466333481.
^ permalink raw [nested|flat] 4+ messages in thread
* Re: [pgvector/pgvector] PR #710: Optimization: added `restrict`
@ 2024-11-09 17:58 "ankane (@ankane)" <noreply+ankane@github.com>
2 siblings, 0 replies; 4+ messages in thread
From: ankane (@ankane) @ 2024-11-09 17:58 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
@ankane closed this.
^ permalink raw [nested|flat] 4+ messages in thread
* Re: [pgvector/pgvector] PR #710: Optimization: added `restrict`
@ 2024-11-09 18:14 "ivanstepanovftw (@ivanstepanovftw)" <noreply+ivanstepanovftw@github.com>
2 siblings, 0 replies; 4+ messages in thread
From: ivanstepanovftw (@ivanstepanovftw) @ 2024-11-09 18:14 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Hi @ankane, see https://github.com/pgvector/pgvector/issues/709#issuecomment-2466373900.
^ permalink raw [nested|flat] 4+ messages in thread
end of thread, other threads:[~2024-11-09 18:14 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-11-09 17:31 [pgvector/pgvector] PR #710: Optimization: added `restrict` "ivanstepanovftw (@ivanstepanovftw)" <noreply+ivanstepanovftw@github.com>
2024-11-09 17:58 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-11-09 17:58 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-11-09 18:14 ` "ivanstepanovftw (@ivanstepanovftw)" <noreply+ivanstepanovftw@github.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox