[clinfo] 87/148: cl_amd_svm support

Andreas Beckmann anbe at moszumanska.debian.org
Mon Nov 17 14:09:49 UTC 2014


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch clinfo
in repository clinfo.

commit be8b33be5dbdbba655bc604555c9dbe8796c9e19
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date:   Mon Oct 27 00:00:39 2014 +0100

    cl_amd_svm support
---
 man/clinfo.1 |  3 +++
 src/clinfo.c | 23 +++++++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/man/clinfo.1 b/man/clinfo.1
index 42d215f..cf79ef1 100644
--- a/man/clinfo.1
+++ b/man/clinfo.1
@@ -49,6 +49,9 @@ for the atomic counter extension;
 .B cl_amd_device_attribute_query
 for AMD-specific device attributes;
 .TP
+.B cl_amd_svm
+for Shared Virtual Memory (SVM) capabilities in OpenCL 1.2 devices;
+.TP
 .B cl_nv_device_attribute_query
 for NVIDIA-specific device attributes;
 .TP
diff --git a/src/clinfo.c b/src/clinfo.c
index 9a971bd..f96b963 100644
--- a/src/clinfo.c
+++ b/src/clinfo.c
@@ -248,6 +248,7 @@ printDeviceInfo(cl_uint d)
 	char has_double[24] = {0};
 	char has_nv[29] = {0};
 	char has_amd[30] = {0};
+	char has_svm[11] = {0};
 	char has_fission[22] = {0};
 	char has_atomic_counters[26] = {0};
 	char has_image2d_buffer[27] = {0};
@@ -388,6 +389,7 @@ printDeviceInfo(cl_uint d)
 			CHECK_EXT(double, cl_APPLE_fp64_basic_ops);
 		CHECK_EXT(nv, cl_nv_device_attribute_query);
 		CHECK_EXT(amd, cl_amd_device_attribute_query);
+		CHECK_EXT(svm, cl_amd_svm);
 		CHECK_EXT(fission, cl_ext_device_fission);
 		CHECK_EXT(atomic_counters, cl_ext_atomic_counters_64);
 		if (!*has_atomic_counters)
@@ -471,7 +473,7 @@ printDeviceInfo(cl_uint d)
 		szval += (*has_fission ? 6 : 4);
 	}
 	if (*has_fission) {
-		strcpy(strbuf + szval, has_fission);
+		strncpy(strbuf + szval, has_fission, bufsz - (szval + 1));
 		szval += strlen(has_fission);
 	}
 	strbuf[szval] = 0;
@@ -692,11 +694,24 @@ printDeviceInfo(cl_uint d)
 	}
 
 	// SVM TODO might also be supported by extensions on 1.2
-	if (is_20) {
+	if (is_20 || *has_svm) {
 		cl_device_svm_capabilities svm_cap;
 		GET_PARAM(SVM_CAPABILITIES, svm_cap);
-		printf(I1_STR "%s\n", "Shared Virtual Memory (SVM) capabilities",
-			had_error ? strbuf : "");
+		if (!had_error) {
+			szval = 0;
+			strbuf[szval++] = '(';
+			if (is_20) {
+				strncpy(strbuf + szval, "core, ", *has_svm ? 6 : 4);
+				szval += (*has_svm ? 6 : 4);
+			}
+			if (*has_svm) {
+				strncpy(strbuf + szval, has_svm, bufsz - (szval + 2));
+				szval += strlen(has_svm);
+			}
+			strbuf[szval++] = ')';
+			strbuf[szval++] = 0;
+		}
+		printf(I1_STR "%s\n", "Shared Virtual Memory (SVM) capabilities", strbuf);
 		if (!had_error) {
 			STR_PRINT(INDENT "Coarse-grained buffer sharing", bool_str[!!(svm_cap & CL_DEVICE_SVM_COARSE_GRAIN_BUFFER)]);
 			STR_PRINT(INDENT "Fine-grained buffer sharing", bool_str[!!(svm_cap & CL_DEVICE_SVM_FINE_GRAIN_BUFFER)]);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/clinfo.git



More information about the Pkg-opencl-commits mailing list