Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b0901c17184b79ceab2efa9344535773@smtp.hushmail.com>
Date: Wed, 26 Sep 2012 07:32:09 +0200
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
Subject: Re: bitslice DES on GPU

On 26 Sep, 2012, at 5:51 , Sayantan Datta <std2048@...il.com> wrote:

> I saw the macro "no_byte_addressable(n)" in opencl_device_info.h. Do you know what should be the argument ?  I mean if I were to use this macro in a #if statement then the argument must be a compile time constant, right?  

You always get a -DDEVICE_INFO=xx when you build your kernel (provided you use eg. opencl_init() from common-opencl.c) and this is a but-field with DEV_xx values from the opencl_device_info.h header. So that is what you pass to no_byte_addressable(n). I use things like this in my kernels:

#include "opencl_device_info.h"

#if gpu_nvidia(DEVICE_INFO) || amd_gcn(DEVICE_INFO)
#define SCALAR
#endif

#if gpu_amd(DEVICE_INFO)
#define USE_BITSELECT
#endif

--8<------8<------8<------8<----

And I use these in host code:

#include "opencl_device_info.h"
...
        int source_in_use = device_info[ocl_gpu_id];

        if (gpu_nvidia(source_in_use) || amd_gcn(source_in_use)) {
                /* Use scalar code */
                VF = 1;
                self->params.algorithm_name = "OpenCL";
        } else {
                /* Use vectorized code */
                VF = 4;
                self->params.algorithm_name = "OpenCL 4x";
        }

...and this alternative way:

        if (get_device_type(ocl_gpu_id) == CL_DEVICE_TYPE_CPU) {
                if (get_platform_vendor_id(platform_id) == DEV_INTEL)
                        local_work_size = 8;
                else
                        local_work_size = 1;
        } else {
                local_work_size = 64;
        }


magnum

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.