Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7957 Discussions

intel_fast_memcpy causing driver code to crash

gdravi
Beginner
413 Views
I am facing a crash problem with our driver code (written in C)when we compile the code with with Intel C Compiler ver 8.0 or 9.0. Our code uses both Microsoft cl compiler and ICL compiler. The C files where we need to optimize in terms of processor cycle counts are compiled with Intel compilerwhile the other files are compiled using Microsoft cl compiler.
I have been able to isolate the problem to a memcpy call. The memcpy call is put in a separate C file and when I compile this memcpy with ICL(Intel C Compiler) ver 8.0 and run some python scripts for testing, the driver crashes. The assembly shows that the memcpy is replaced by "intel_fast_memcpy" call. The same memcpy function if I compile with Microsoft cl or ICL ver 7.0 then the driver works fine with the python scripts With CL and icl ver 7.0 there is no "intel_fast_memcpy" call.
Has anyone faced code crash issue with "intel_fast_memcpy" call ??
0 Kudos
1 Reply
oinkaroonie
Beginner
413 Views
I have successfully used this simple method.
  1. Create a simple source file intel_hack.c that contains this:

    #include 

    void *
    _intel_fast_memset(void *s, int c, size_t n)
    {
    memset(s, c, n);
    }

    void *
    _intel_fast_memcpy(void *t, void *s, size_t n)
    {
    memcpy(t, s, n);
    }

    void *
    _intel_fast_memcmp(void *t, void *s, size_t n)
    {
    memcmp(t, s, n);
    }
  2. Compile it:

    make intel_hack.o

  3. Put it in a library:

    ar r libintel.a intel_hack.o

  4. Put the library somewhere in the lib path:

    cp libintel.a /usr/local/lib

  5. Specify LIBS='-lintel' as needed. For example, I ran into this problem while compiling PHP5 with mysql support, so I ran its configure program like:

    LIBS='-lintel' ./configure --with-mysql=/usr/local/mysql ...

    You can usually specify this as an argument to make, as well:

    make "LIBS = -lintel"

    (Note that spaces around = are allowed in the make context but not in the shell context.)
When the loader resolves external references against the libraries, it uses our new little libintel.a library to resolve the Intel references to the regular (non-Intel) routines.

Regards,
Steve
0 Kudos
Reply