Project: Part3 – Optimizing and porting argon2 package using C and Assembler language(Progress 1)

Requirements/ System Specifications.

Argon2 Password hashing function package:

https://github.com/P-H-C/phc-winner-argon2

Aarch64 Fedora 28 version of Linux operating system

Cortex-A57 8 core processor

One set of Dual-Channel DIMM DDR3 8GB RAM (16GB in total)

Change of plans for the project.

The original plan for my project stage 3 was this:

Modified Testing Stage(Modified Program):

I will change some of the code in the base program to attempt optimization. The changes can be algorithm changes, new inline assembler code, or removing unnecessary code.
I will run the changed program multiple times to check if there are any bugs or problems compared to the base program. The testing requirements/variables are: compile time, program run time, file size, and program produced result.
I will test if the GNU C program compiler is able to further optimize the changed program by using optimization levels 0 to 3.

I did not foresee the package having through optimization for the following hardware: Amd64, x86_64, i386, and x86. This can be seen in the source code file called bench.c.

Here is a sample of the code, starting from line 29:

static uint64_t rdtsc(void) {
#ifdef _MSC_VER
return __rdtsc();
#else
#if defined(__amd64__) || defined(__x86_64__)
uint64_t rax, rdx;
__asm__ __volatile__("rdtsc" : "=a"(rax), "=d"(rdx) : :);
return (rdx << 32) | rax;
#elif defined(__i386__) || defined(__i386) || defined(__X86__)
uint64_t rax;
__asm__ __volatile__("rdtsc" : "=A"(rax) : :);
return rax;
#else
#error "Not implemented!"
#endif

The red highlighted lines checks which processor architecture is being used.

I did notice that the bench testing program did not have the ability to test the Aarch64 type of processor.

I will try to optimize the program for testing in any architecture.

(I will continue in progress 2)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s