e_write/e_read confusion - Epiphany ram

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

e_write/e_read confusion - Epiphany ram

Postby AndyC » Fri Aug 22, 2014 8:13 am

Hi Guys,

Using a device I can write and read to the epiphany ram with no problem.

If I try to use a e_mem_t though it doesn't work:

Code: Select all
e_mem_t       eram;
e_alloc(&eram, 0, 0x8000);

ProcessFlag writeFlag = pfSamplesReady;
ProcessFlag readFlag = pfInit;

e_write(&dev, 0, 0, uProcessFlagOffset, &writeFlag, sizeof(ProcessFlag));
e_read(&eram, 0, 0, uProcessFlagOffset, &readFlag, sizeof(ProcessFlag));

if(writeFlag == readFlag)
  printf("worked\n");
else
  printf("failed\n");


The above prints failed.

I'm obviously misunderstanding something here, what is it?

Thanks for any help

Andy
AndyC
 
Posts: 184
Joined: Fri Jun 27, 2014 5:46 pm

Re: e_write/e_read confusion - Epiphany ram

Postby notzed » Fri Aug 22, 2014 11:28 am

e_alloc() only maps memory in the shared area.

You're reading/writing to completely different locations, not surprisingly since the arguments are completely different objects.
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: e_write/e_read confusion - Epiphany ram

Postby AndyC » Fri Aug 22, 2014 11:35 am

Hi,

Thanks for the info.

The e-bandwidth-test example code tests host to ERAM speed using this method, is this a different ERAM then?
AndyC
 
Posts: 184
Joined: Fri Jun 27, 2014 5:46 pm

Re: e_write/e_read confusion - Epiphany ram

Postby notzed » Tue Aug 26, 2014 12:48 am

AndyC wrote:Hi,

Thanks for the info.

The e-bandwidth-test example code tests host to ERAM speed using this method, is this a different ERAM then?


I don't understand this question.

I'm just saying if you write to "eram", don't expect to read the same value from host ram.

Your objects: "eram" is in shared memory. "dev" is on the core. They are not the same location.
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: e_write/e_read confusion - Epiphany ram

Postby AndyC » Wed Aug 27, 2014 1:40 pm

Hi,

It was me getting confused with the naming conventions.

As far as I see it there is:

1. Host Ram
2. Shared ram
3. Epiphany local ram

I took ERAM to mean 3 where as far as I can see it is actually 2.

Cheers

Andy
AndyC
 
Posts: 184
Joined: Fri Jun 27, 2014 5:46 pm

Re: e_write/e_read confusion - Epiphany ram

Postby notzed » Thu Aug 28, 2014 2:44 am

Yes the object in your example called "eram" is in 2, the shared memory.

Hence I would give it a more accurate and mnemonic name, like "sram" ;-) and reserve the mnemonic "eram" for e(piphany) ram.
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: e_write/e_read confusion - Epiphany ram

Postby sebraa » Thu Aug 28, 2014 12:42 pm

Why not use the official terms? 8-)
- Host Memory (not really important when programming for the Epiphany, since it can't access it)
- Shared Memory or Shared DRAM (or External DRAM or DRAM, but these suggest different things to me)
- Local Memory or SRAM
They are used in the official documentation and in the linker scripts. ERAM then means "External RAM".
sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm

Re: e_write/e_read confusion - Epiphany ram

Postby AndyC » Thu Aug 28, 2014 12:49 pm

Hi,

ERAM is not defined in the documentation at all as far as I can see.
AndyC
 
Posts: 184
Joined: Fri Jun 27, 2014 5:46 pm

Re: e_write/e_read confusion - Epiphany ram

Postby notzed » Fri Aug 29, 2014 3:40 am

sebraa wrote:Why not use the official terms? 8-)
- Host Memory (not really important when programming for the Epiphany, since it can't access it)
- Shared Memory or Shared DRAM (or External DRAM or DRAM, but these suggest different things to me)
- Local Memory or SRAM
They are used in the official documentation and in the linker scripts. ERAM then means "External RAM".


Just because it's "official" doesn't mean it's good or can't be improved.

The OpenCL nomenclature is quite appropriate and succinct: local and global.

I also personally like using LDS = local data store, for "local ram", from CELL BE iirc.
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: e_write/e_read confusion - Epiphany ram

Postby sebraa » Fri Aug 29, 2014 2:32 pm

AndyC wrote:ERAM is not defined in the documentation at all as far as I can see.
That is true, although the linker script refers to the lower and upper parts of it as EXTERNAL_DRAM_0 and EXTERNAL_DRAM_1, respectively.

notzed wrote:Just because it's "official" doesn't mean it's good or can't be improved.
I agree. But unless we standardize on something, confusion will always happen. Defining "sram" and "eram" to mean the exact opposite of Adaptevas naming is not going to help. (I see the joke, though.)
sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 4 guests

cron