Bug 224584 - [PATCH] lang/pocl: fix pkg-plist and update to POCL 1.2
Summary: [PATCH] lang/pocl: fix pkg-plist and update to POCL 1.2
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Nikolai Lifanov
Keywords: patch
: 223032 224368 224458 226092 (view as bug list)
Depends on: 219562 233495
Blocks: 231286
  Show dependency treegraph
Reported: 2017-12-25 15:07 UTC by O. Hartmann
Modified: 2019-01-09 23:15 UTC (History)
9 users (show)

See Also:

POCL 1.0-patch and pkg-plist fix (4.22 KB, text/plain)
2017-12-25 15:07 UTC, O. Hartmann
no flags Details
Update of ohartman works (9.34 KB, patch)
2018-01-09 05:29 UTC, lbartoletti
no flags Details | Diff
lang/pocl: unbreak and update to 1.0 (8.68 KB, patch)
2018-02-21 20:06 UTC, Nikolai Lifanov
no flags Details | Diff
Makefile adapting POCL 1.1 (2.41 KB, patch)
2018-04-02 12:13 UTC, O. Hartmann
no flags Details | Diff
POCL-1.2-RC2 (7.05 KB, patch)
2018-09-07 14:17 UTC, O. Hartmann
no flags Details | Diff
Update to POCL 1.2 Release (7.81 KB, patch)
2018-10-01 08:41 UTC, O. Hartmann
no flags Details | Diff
Update to POCL 1.2 official release (7.81 KB, patch)
2018-10-01 08:45 UTC, O. Hartmann
no flags Details | Diff
Update POCL 1.2 Release (with LLVM 7.0 as default backend) (6.79 KB, patch)
2018-10-02 07:04 UTC, O. Hartmann
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2017-12-25 15:07:00 UTC
Created attachment 189095 [details]
POCL 1.0-patch and pkg-plist fix

POCL  1.0 has been released. According to Bug 223032 there is a problem in pkg-plist, which is fixed with the workaround provided here: replace -unknown- by -portbld-, see patch diff.

The attached file is a svn diff against lang/pocl.

I've checked so far with poudriere to build the port lang/pocl and it built clear in my testenvironment.

I haven't looked deeper into the changes made by the developers (i.e. the CUDA backend).

Further testing is prohibited by Bug 223879 , Bug 219562 .
Comment 1 Bugzilla Automation freebsd_committer 2017-12-25 15:07:00 UTC
Maintainer informed via mail
Comment 2 Yuri Victorovich freebsd_committer 2017-12-25 17:52:11 UTC
*** Bug 224458 has been marked as a duplicate of this bug. ***
Comment 3 lbartoletti 2018-01-09 05:27:33 UTC

I tried to build it without success (patch files aren't applied). Can you double check it? I will put you my patch based on your works.

But, there is another problem, pocl crash and tests failed ; maybe my patch is wrong.

Comment 4 lbartoletti 2018-01-09 05:29:06 UTC
Created attachment 189556 [details]
Update of ohartman works
Comment 5 w.schwarzenfeld freebsd_triage 2018-02-21 18:58:53 UTC
See also Bug #226092.
Comment 6 Nikolai Lifanov freebsd_committer 2018-02-21 20:06:59 UTC
Created attachment 190869 [details]
lang/pocl: unbreak and update to 1.0

Hi! Have another patch from a duplicate issue (BZ#224584)

o unbreak lang/pocl at package time
o unbreak lang/pocl at runtime
o update lang/pocl to 1.0
o switch to fetching from Github
o switch to LLVM 5.0
o pet portlint

This was tested with security/hashcat on 12.0-CURRENT
Comment 7 Nikolai Lifanov freebsd_committer 2018-02-21 20:07:34 UTC
*** Bug 226092 has been marked as a duplicate of this bug. ***
Comment 8 Nikolai Lifanov freebsd_committer 2018-02-21 20:23:07 UTC
I'm going to take this bug.

O. Hartmann: what's still TODO to move this forward?
Comment 9 Johannes M Dieterich freebsd_committer 2018-02-23 03:53:57 UTC
It definitely compiles and packages fine - so that's progress.

It also on executing clinfo look better (none of the previously reported issues) but hangs for me then. I am seeing this issue also elsewhere, so not sure that it's due to this.

I honestly think this can go in (assuming maintainer approval) as it is either way an improvement on the current situation. We can then sort whatever bugs appear subsequently?
Comment 10 O. Hartmann 2018-02-23 18:27:29 UTC
(In reply to Johannes M Dieterich from comment #9)

I have no objection with that, although the port isn't very healthy in this state - there is still a serious issue, please see Bug 219562 .

When lang/pocl is installed (with devel/ocl-icd) and graphics/blender has been compiled with CYCLES, blender (at the moment R2.79) fails with the same bug as reported in Bug 219562 . Ichecked. It is still present. Also, a very simple peice of code of my own, similar to clinfo, reporting the devices available in the system, fails with the error reported in the forementioned bug. See Bug 219562 for further informations.

Anyway, please do not rely on me in this matter! I think I'd go with Johannes M Dieterich opinion that it would be better to have a compiling port so far.

Comment 11 O. Hartmann 2018-04-02 11:03:22 UTC
*** Bug 223032 has been marked as a duplicate of this bug. ***
Comment 12 O. Hartmann 2018-04-02 12:08:42 UTC
POCL 1.1 is out. But according to this bug:


the pocl tests fail and so the installation of the port due to this error message:

The following tests FAILED:
          1 - pocl_version_check (Failed)

The version can not be tested, since it fails with message:

1/197 Test   #1: pocl_version_check ..................................................................***Failed  Required regular expression not found.Regex=[basic]  0.02 sec

From POCL USER mailing list, I received word from Michal Babej upon this error and following his instructions (by fixing a csh/sh issue first in the appropriate script of the test performed):


# (sh ./tools/scripts/devel-envs.sh && clinfo)

gives me 

Unable to find symbol pthread_mutexattr_setkind_np version (null). Aborting.

Well, this, again, and again, seems to be related to this LLVM bug:


which I also mentioned in Bug 223032.

In my case, it seems graphics/belnder which requires LLVM 4.0 due to openshading language support, but the issue seems tricky as it occurs on FreeBSD whenever another OpenCL platform is also  backed via LLVM. In the case for POCL 1.1, I use LLVM 6.0. But the error also shows up with LLVM 5.0.

I'm out of ideas, time, mental capabilities. I's like to put the small effords I made (simply adopting the changes to reel in pocl 1.1 instead of pocl 1.0) here to the public, so someone can take a look. Due to the issue mentioned above (LLVM seems not to check for beeing the backend for multiple OpenCL platforms when dynamically linked to those platforms), POCL isn't working properly on FreeBSD with other OpenCL platforms selectable via an ICD like devel/opencl-icd. This sucks :-(
Comment 13 O. Hartmann 2018-04-02 12:13:21 UTC
Created attachment 192103 [details]
Makefile adapting POCL 1.1

The attached Makefile is a-work-in-progress to adopt POCL 1.1. It is not a replacement for the patch to move to our port to POCL-1.1 since tests fail and therefore the essential pkg-plist updates and checksums aren't in shape.

For your considerations.
Comment 14 Kubilay Kocak freebsd_committer freebsd_triage 2018-04-02 12:37:29 UTC
*** Bug 224368 has been marked as a duplicate of this bug. ***
Comment 15 O. Hartmann 2018-04-11 09:02:44 UTC
I had to fix devel/ocl-icd first: somehow linking against pthreads wasn't there, so I had to add a configure option to make it working. Additionally to that, I tried to update to ocl-icd 2.2.12. Hopefully, the patch gets commited soon.

Now things regarding lang/pocl are getting a bit confusing. Since there is a serious problem according to a supposedly still remaining bug in LLVM (see http://lists.llvm.org/pipermail/llvm-bugs/2016-October/051237.html), updating to POCL 1.1 is now due to a test suite performed by the pocl source framework blocks installing POCL 1.1 as we know it from POCL 1.0.
Comment 16 O. Hartmann 2018-04-11 09:03:25 UTC
See Bug 226514.
Comment 17 O. Hartmann 2018-09-07 14:17:28 UTC
Created attachment 196942 [details]

For your consideration: POCL-1.2-RC2 adaption. Still seeing the bug: 

: CommandLine Error: Option 'enable-value-profiling' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Comment 18 Yuri Victorovich freebsd_committer 2018-09-21 06:07:39 UTC
What is the status of this?
Comment 19 O. Hartmann 2018-10-01 08:40:50 UTC
(In reply to Yuri Victorovich from comment #18)

POCL 1.2 has been releas on September, 25th. I try to check the port now with LLVM 7.0 as I have hope the nasty bug with multi-registering the very same LLVM backend, which prevents using an ICD (as devel/ocl-icd) has been solved - but I doubt that, since there is no report of any kind of mitigation.

My time- and barin-resources in this matter are limited, I regret.

VECMATH is going to be deprecated by POCL soon. Also, POCL 1.2 supports HWLOC2, FreeBSD doesn't support HWLOC 2, port devel/hwloc is still HWLOC 1. Maybe this could also be changed soon.

Attached, you'll find my latest attempt to maintain the port, with LLVM60 as the default.
Comment 20 O. Hartmann 2018-10-01 08:41:57 UTC
Created attachment 197659 [details]
Update to POCL 1.2 Release

Update to POCL 1.2, still LLVM60 as default.
Comment 21 O. Hartmann 2018-10-01 08:45:11 UTC
Created attachment 197660 [details]
Update to POCL 1.2 official release

My apology for the inconvenience, I needed to obsolete the old files.

The new patch incorporates most of the fixes done by developers herein and the small update by myself.
Comment 22 Brooks Davis freebsd_committer 2018-10-01 23:07:24 UTC
(In reply to O. Hartmann from comment #21)

I tried this attachment and patch-lib_CL_devices_cpuinfo.c doesn't apply for me.
Comment 23 O. Hartmann 2018-10-02 07:04:15 UTC
Created attachment 197701 [details]
Update POCL 1.2 Release (with LLVM 7.0 as default backend)

Attached, you'll find a corrected patchset. It is for auditing purposes. Enabling LLVM 7.0 as the default backend doesn't solve the error:

X server found. dri2 connection failed! 
Device open failed, aborting...
: CommandLine Error: Option 'limited-coverage-experimental' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Nothing to output !

This check was made by devel/clinfo.
Comment 24 John Hein 2018-11-24 18:16:58 UTC
(In reply to O. Hartmann from comment #23)
I get a similar error if lang/beignet and lang/clover are installed:

Simple test case:

#include <CL/opencl.h>
#include <stdio.h>
    unsigned int uu;
    printf("rc: %d\n", clGetPlatformIDs(0, 0, &uu));
    printf("uu: %u\n", uu);
    return 0;

% cc -Wall -I/usr/local/include -L/usr/local/lib -lOpenCL cl.c -o cl
% ./cl
X server found. dri2 connection failed!
Device open failed, aborting...
: CommandLine Error: Option 'enable-value-profiling' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Nothing to output !

clGetPlatformIDs() apparently is calling exit when it detectes what it thinks is an error (a very impolite think for a library to be doing).

Is it expected that beignet and clover should not be installed together for use with OpenCL?

See also bug 232357
Comment 25 John Hein 2018-11-25 00:53:39 UTC
See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852746
Comment 26 Brooks Davis freebsd_committer 2019-01-09 23:15:31 UTC
Is there any reason not to upgrade to LLVM 7.0?

AFACT, clinfo issues are irrelevant as it's either missing a required dependency to prevent multiple links to libllvm or it's broken by design.