From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by sourceware.org (Postfix) with ESMTPS id E8B113858D34 for ; Tue, 2 Jun 2020 11:06:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E8B113858D34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x341.google.com with SMTP id g10so2489009wmh.4 for ; Tue, 02 Jun 2020 04:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:subject:message-id:mime-version:content-disposition; bh=Qbq18S13VdlMr0IMLjOnNcFn0ZoHMCusQAWKadOIh8A=; b=OX8LDYG0klYmV/y1KxUqa+qQi1/68UPf/ZPnGURaU/PBzxGdwXI3PU2AzKxt2KPHDN rUAGvh34ksT8i8ZDCkca53wLnJAMR+GH8niyHeQNYhTAewgcJINWfEHD0GQCuUiQEyUV /YSz6vL3XVFWJ2n0RgzyJEksaMxhJ2CSNaKEBFndMzvc4vD0q0mAo5OgWoAjozdkWqeV qHd85kKhjhCv4U8VSP2Z3s9rNPzZ8gaIIof0pUn+NrpGop+HefEx+GOfkkwxJ/T2L2M7 3JVfvMFWVxzLrH6HCyXVVZmpV54d+KN4gdbewWACE0CKEqUf4v8QXGtFq3fPUn9uLpmL I8TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=Qbq18S13VdlMr0IMLjOnNcFn0ZoHMCusQAWKadOIh8A=; b=ZlHOzPvW2WWH8trCTfrliWuYPqo5b213/FN6mmrfo+SJrD7nzORTInuBkyT/zW1tTW FX62dQXZHfaBY0x+YHtUca0S27yf6+zdtlpt0Gqx1BvVA69osxjDzeciUxD8jsZ2yWMX N1k1SsUc1QQI2DyCmV9MyelX5JVPA80zGLdNDM2vKRHZKbNHgVhQFJuSMOFPGC7Xzg/R wXf/5sm7r6gBJylmAbxWPVWBPSb9P5pVT7HQBfy8VKFs5M2Ov9Iup5NQokbXpkR3UZRt xs8xv3BhBVkKk7ApqOk7v1c6czauoZVSyUb/+l8xlanGDuB1PM8RP9I240Hp/NQ/NW2e WQZw== X-Gm-Message-State: AOAM530qQzBdZ1R9OFNtuvDYeCYcqxJ+Ao/n19RUYURrC3AHA8Leo6cb Cu8/PlgZ8MM/dNciQ1gGqIcgzKHqOsE= X-Google-Smtp-Source: ABdhPJykmRSBSTF7ZRuHglwB0wU9i9b6H9ashQTN2eia1McG4qh3GjY5wOFrKfw7t39o2Ag0NU4yqA== X-Received: by 2002:a1c:65c2:: with SMTP id z185mr3458689wmb.125.1591095977472; Tue, 02 Jun 2020 04:06:17 -0700 (PDT) Received: from localhost (host86-128-12-16.range86-128.btcentralplus.com. [86.128.12.16]) by smtp.gmail.com with ESMTPSA id r2sm3421269wrg.68.2020.06.02.04.06.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 04:06:16 -0700 (PDT) Date: Tue, 2 Jun 2020 12:06:15 +0100 From: Andrew Burgess To: gdb@sourceware.org Subject: GDB's OpenCL Tests Message-ID: <20200602110615.GJ2242921@embecosm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: Linux/5.5.17-200.fc31.x86_64 (x86_64) X-Uptime: 11:39:06 up 43 days, 1:13, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2020 11:06:29 -0000 I wonder if anyone is regularly running the OpenCL tests for GDB? I'm running Fedora 31. Initially None of the OpenCL tests would run due to the libOpenCL library being missing, so I installed the packages `ocl-icd', `ocl-icd-devel', and `opencl-headers'. After this I did have libOpenCL.so, but things were still not working. I was mostly looking at the gdb.opencl/callfuncs.exp test, just because it was the first test file, but I don't believe it is anything special, in fact, the failures I was seeing came from the file gdb/testsuite/lib/opencl.exp function skip_opencl_tests, when we're just checking if opencl is supported or not. The compile was failing with this message: /usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2) 34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)") | ^~~~~~~ This is actually just a warning, but this is still enough to cause GDB's testsuite to abandon the build. A quick google, and "random internet stranger" recommended adding something like: #define CL_TARGET_OPENCL_VERSION 120 to the offending source files, so I added this to: gdb/testsuite/lib/cl_util.c gdb/testsuite/lib/opencl_hostapp.c I'm aware that at this point I'm just making random changes, so it's not really surprising that nothing after this works, but lets push on... .... success, things now compile, but, almost all the tests are still failing. What I see is this pattern in basically every test: (gdb) tbreak testkernel Function "testkernel" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Temporary breakpoint 1 (testkernel) pending. (gdb) PASS: gdb.opencl/datatypes.exp: Set pending breakpoint run .... [Inferior 1 (process 2840279) exited normally] (gdb) FAIL: gdb.opencl/datatypes.exp: run (the program exited) The 'testkernel' seems to be the core entry point function within the actual opencl program, so we never hit that symbol. It was at this point that I started to grow suspicious that nobody is running these tests much (or at all?), the gdb.opencl/callfuncs.exp test contains this gem: gdb_load ${objdir}/${subdir}/${testfile} Which doesn't take account of the /output/ directory that was added into the directory structure ages ago. I applied patch #1 (below) to fix this. Still not hitting the testkernel symbol... So now I ran the test manually under GDB, break at 'exit' and then 'rbreak testkernel', this sets 3 breakpoints for me. Start the test up again with 'run', and I hit one of the breakpoints, here's what I see: Thread 25 "callfuncs" hit Breakpoint 3, 0x00007ffff7fc9354 in _pocl_kernel_testkernel_workgroup () from /home/andrew/.cache/pocl/kcache/BA/OLMGEJJKCCPFCOMNNHDOJKFDNOKMKEPPCEIPJ/testkernel/16-1-1-goffs0-smallgrid/testkernel.so (gdb) bt #0 0x00007ffff7fc9354 in _pocl_kernel_testkernel_workgroup () from /home/andrew/.cache/pocl/kcache/BA/OLMGEJJKCCPFCOMNNHDOJKFDNOKMKEPPCEIPJ/testkernel/16-1-1-goffs0-smallgrid/testkernel.so #1 0x00007ffff070fe6d in pocl_pthread_driver_thread () from /lib64/libpocl.so.2.5.0 #2 0x00007ffff1d324e2 in start_thread () from /lib64/libpthread.so.0 #3 0x00007ffff7d7a6a3 in clone () from /lib64/libc.so.6 I then use 'objdump -W' to look at the debug information in testkernel.so, and it has no extra debug at all. So, my questions: - Can anyone successfully run some or all of the OpenCL tests? - And can anyone give me any hints on what I might need to do to get the tests running? Thanks, Andrew --- ## START - Patch 1 ## diff --git a/gdb/testsuite/gdb.opencl/callfuncs.exp b/gdb/testsuite/gdb.opencl/callfuncs.exp index cf418d16582..1452c403c90 100644 --- a/gdb/testsuite/gdb.opencl/callfuncs.exp +++ b/gdb/testsuite/gdb.opencl/callfuncs.exp @@ -33,12 +33,7 @@ if { [gdb_compile_opencl_hostapp "${clprogram}" "${testfile}" "" ] != "" } { return -1 } -gdb_exit -gdb_start - -# Load the OpenCL app -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${objdir}/${subdir}/${testfile} +clean_restart ${testfile} # Set breakpoint at the OpenCL kernel gdb_test "tbreak testkernel" \ ## END - Patch 1 ##