Questions tagged [cpu-architecture]
The hardware microarchitecture (x86, x86_64, ARM, ...) of a CPU or microcontroller.
3,618
questions
0
votes
0
answers
5
views
Do memory instructions pass through the load-store queue and issue queue in the microarchitecture
What is the difference between the issue queue and lsq queue for
memory instructions? Do memory instructions pass through both queues, or do they only pass
through the lsq queue.
If they pass through ...
0
votes
3
answers
34
views
Understanding address assignment to registers via assembly instructions
If I have a CPU/system with the following characteristics...
16 bit architecture (16 bit registers and bus)
8 total registers
A set of 64 assembly instructions
And assuming my assembly instructions ...
0
votes
0
answers
20
views
Where GPU read/write data
I am trying to understand below lines from here
How quickly can data be sent to the GPU or read back from it?
How fast can the GPU kernel read and write data?
How quickly can data be sent to the GPU? ...
0
votes
0
answers
24
views
Difference between load and prefetch instructions?
What is difference between load and prefetch instructions?
In terms of computer architecture and what happens in the cache!
2
votes
1
answer
53
views
RISCV branchless coding
On Intel AVX, there is a possibility of branchless code.
Instead of branching for case0 or case1, you can compute both cases, and blend the results based on a condition.
AVX does this 8 way for float ...
2
votes
0
answers
75
views
Add-Instruction is faster than the processor itself [duplicate]
I have this code (Some instructions are added for benchmark fairness):
.global count_forloop
.global count_addloop
.global count_mulloop
.global count_divloop
count_forloop:
push %rsi
push %...
0
votes
0
answers
32
views
how does the assembler know which type of machine code to generate?
So I know that assemblers are basically programs that convert say C code to certain machine code that the CPU can understand. Now my question is, how does the assembler know what kind of machine code ...
0
votes
0
answers
23
views
Docker Image with Different Arch Works Just Fine, Why?
I am trying to figure out why a Docker image that I built using my Intel Macbook works on my M1 Macbook (It does spit out a warning about the platform but still runs).
On my Intel machine, I created a ...
0
votes
1
answer
29
views
gdb-multiarch (MINGW64) cannot determine architecture from executable?
I have seen in Specifying an architecture in gdb-multiarch :
If I compile a C program with any arm compiler (e.g. arm-none-eabi-gcc) and afterwards call gdb-multiarch with the binary as second param(...
0
votes
1
answer
27
views
How to find critical path / max clock rate for multicycle datapath?
I was wondering how to obtain the longest time it takes for an instruction to complete in a multicycle datapath. I understand Load word is the longest instruction, but I have heard that the process ...
0
votes
1
answer
19
views
How do I determine the hit ratio of the following direct-mapped cache?
I have a direct-mapped cache with the following properties:
Address size = 32 bits
Cache block size = 8 words
Entries = 32
So we can see the cache as a 32 by 8 table where the index selects the row ...
2
votes
1
answer
93
views
Sharing a TLB entry between two logical CPUs (Intel)
I wondered if it is possible if two threads belonging to the same program with the same PCID can share the TLB entry when they are scheduled to run on the same physical CPU?
I already looked into the ...
0
votes
1
answer
31
views
How many True dependencies does this code have?
LW t1, 0(t4) ; t1 ← address (0+t4)
ADDI t1, t1, #8 ; t1 ← t1+8
MULT t3, t1, t1 ; t3 ← t1*t1
SW t3, 4(t2) ; address(4+t2) ← t3
I'm currently unable to tell how many true dependencies this code has. ...
2
votes
0
answers
45
views
Use "arithmetic shift right" as "less than zero"
Is the following:
psrad xmm0, 31 ; arithmetic (sign-extend) shift right
equivalent to:
xorps xmm1, xmm1 ; zero
cmpps xmm0, xmm1, 1 ; less than
I am interested to know, because the ...
0
votes
1
answer
30
views
Why A and B registers are used in multicycle Datapath?
Why are registers A and B whose inputs are ReadData1 and ReadData2 of RegisterFile are necessary? Isn't it possible to use directly the values which are on ReadData1 and ReadData2 outputs of Register ...
2
votes
1
answer
60
views
Explanation for why effective DRAM bandwidth reduces upon adding CPUs
This question is a spin-off of the one posted here: Measuring bandwidth on a ccNUMA system
I've written a micro-benchmark for the memory bandwidth on a ccNUMA system with 2x Intel(R) Xeon(R) Platinum ...
-1
votes
0
answers
22
views
Create a branch history in loop
Consider
int t = 0;
for( int i = 0; i < 8; i++ )
{
for( int j = 0; j < 8; j++ )
{
t = t + i*j;
}
}
Ex: Create a branch history table in t = t + i*j if we assume branch taken in ...
0
votes
0
answers
29
views
Optimize a loop for static predict-not-taken? Which prediction problems exist for that in a normal loop?
Which problems arise in the following assembly loop, if Predict Not Taken is chosen by default? Optimize the example to Predict not Taken.
addi $s1, $zero, 1024 // s1 := 1024
loop: addi $s1, $s1, -1 //...
1
vote
1
answer
56
views
Can compilers break control dependencies used for LoadStore memory ordering or similar, in any real use-cases?
I'm reading the mail list about LKMM: Add volatile_if(). The control dependency is somewhat subtle since it is easily forgotten by us developers. So I wonder is there any real case that is caused by ...
-1
votes
0
answers
22
views
Operating system interrupt handler and CPU in virtual memory access
Which of these activities are performed by the CPU while execution the instructions and which by the Operating System (OS) interrupt handler that manages page faults? I am not sure about the ...
4
votes
1
answer
117
views
Why didn't x86 implement direct core-to-core messaging assembly/cpu instructions?
After serious development, CPUs gained many cores, gained distributed blocks of cores on multiple chiplets, numa systems, etc but still a piece of data has to pass through not only L1 cache (if on ...
1
vote
1
answer
45
views
Does L1 cache accept new incoming requests while its Line Fill Buffers (LFBs) are fully exhausted?
I wonder if L1 cache still receives new requests that hit L1D, making forward progress for the pipeline when Line Fill Buffers (LFBs or MSHRs) get full?
Or could anybody help me write a microbenchmark ...
4
votes
1
answer
155
views
C++ atomics and memory_order with RDMA
When using one-sided RDMA on modern memory, lock-free, the question arises of how a remote reader can safely view their incoming data if the data objects span multiple cache lines.
In the Derecho open-...
0
votes
0
answers
22
views
Write allocation policy with caches [duplicate]
I was just wondering about in write allocation policy of caches, first we access data from main memory and put into cache and then update in the cache. If anyway we use write back policy to counter ...
0
votes
0
answers
28
views
What is an address/range of addresses that are guaranteed to be not used in x86-64?
I am writing a version of malloc that is compatible with multi-threading. Is is going to use arenas to help facilitate the parallelism.
mmap is being used to create the arenas. Using NULL as the input ...
0
votes
0
answers
96
views
Direct Mapping Cache Exercise
Consider a computer with the following characteristics: total of 1Gbyte of main
memory; word size of 1 byte; block size of 32 bytes; and cache size of 128 Kbytes.
a)For the main memory addresses of ...
0
votes
0
answers
17
views
[risc-v]does 2-way Simultaneous multithreading core share register files, or do they have separate registers? [duplicate]
For example, in an 4-core system with 2-way SMT, you have 8 harts, which is it? 4 separate x0-x31 registers ,pc, and csrs, or 8 separate x0-x31, pc, and csrs?
0
votes
0
answers
11
views
How does hardware (cpu or similar) provide any protection for the OS's essential memory [duplicate]
So basically this might be a dumb question but how does hardware (cpu or related) protect virtual data even though all the cpu or any other hardware is doing is sending electricity around, it wouldn't ...
-4
votes
0
answers
36
views
Write simultaneously two mesochronous inputs into a single port sram
I am trying to figure out a method how to write simultaneously two inputs into a single port SRAM module.
The two inputs have the same clock frequency but different phase.
The worst scenario is that ...
0
votes
1
answer
34
views
cpuid: reported micro-architecture seems ambiguous
Ubuntu 20.04 LTS. Note (unknown type) reported:
$ cpuid | less
CPU 0:
vendor_id = "GenuineIntel"
version information (1/eax):
processor type = primary processor (0)
family ...
1
vote
0
answers
45
views
Custom Instruction crashing with SIGNAL 4 (Illegal Instruction): RISC-V (32) GNU-Toolchain with QEMU
I have been wanting to develop and understand the process of creating custom extensions for a large-scale task I have, involving RISC-V compilation using the QEMU emulator. I have been loosely ...
5
votes
1
answer
164
views
Performance differ significantly when inner loop iterates less times?
I wrote a toy program that compares the performance of two very similar functions. The entire file (minus a couple of macros) looks like this:
constexpr int iterations = 100000;
using u64 = uint64_t;
...
0
votes
1
answer
37
views
Assuming that you had a MIPS processer with PIPELINE but without hazard prevention nor forwarding, would this be the correct placement of NOP?
I would like to check my work and understanding of pipelines, unfortunately MARS doesn't accommodate this feature so it is hard to verify my hypothesis.
I placed the instructions in a spreadsheet to ...
0
votes
0
answers
86
views
Why does riscv32-gcc use LI and ADDI to put a 32-bit constant in a register, not LI with the full constant?
....
//---------------------------------
// Init State
//---------------------------------
int32_t state[16];
state[0] = 0x61707865;
...
|| c -> asm(riscv32-gcc -S inputcode.c)
|| ...
-1
votes
1
answer
97
views
Bad CPU type in executable mac Intel core
Trying to install a specific version of nvm
But I get
nvm install 16.14.2
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/...
0
votes
1
answer
56
views
Why is the IEEE754 double precision format only accurate to 15 digits?
I am currently learning about floating point representations. According to this website, here are the possible ranges for this representation. -1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308. ...
2
votes
1
answer
42
views
How to determine machine architecture in Python? [duplicate]
I'm wondering how to find the architecture of the machine python is running on and save it to a string.
The only other example I've been able to find works only on Windows, and doesn't even detect the ...
-2
votes
1
answer
21
views
I want to find the expexted hazards until CC7(clock cycle 7) with appropriate reasons and solution
I want to find the expexted hazards in below code until clock cycle 7 with appropriate reasons and solution.
1: sub $2,$2,$3
2: lw $4, 0($2)
3: and $1,$4,$2
4: beq $1,$2,1
5: or $5,$1,$6
6: add $2,$5,$...
0
votes
0
answers
16
views
Direct mapped cache - Small cache block size and high offset
I have to deal with different cache block sizes ranging from 4 to 128 for 16-bit words, depending on the cache controller mode. The adresses are 20-bit long with 8 bits for tag, 8 bits for cache ...
0
votes
2
answers
79
views
Why does this piece of code written using uint8_t run faster than analogous code written with uint32_t or uint64_t on a 64bit machine?
Isn't the common knowledge that math operations on 64bit systems run faster on 32/64 bit datatypes than the smaller datatypes like short due to implicit promotion? Yet while testing my bitset ...
-1
votes
1
answer
46
views
How can output from parent and child of fork() system call interleave with each other?
code reads something like :
pid=fork()
if(pid){
print parent_id
print parent_id
}
else{
print child_id
print child_id
}
when it was executed it was
child
parent
child
parent
I ...
0
votes
1
answer
44
views
Page table look-up vs TLB look-up
From https://cs.stackexchange.com/questions/119744/how-does-a-tlb-lookup-compare-all-keys-simultaneously and https://en.wikipedia.org/wiki/Content-addressable_memory, look-up a key in TLB could be ...
0
votes
0
answers
50
views
How to calculate expected CPI and cpu time when instruction types are given?
I got two questions about cpu time and CPI but it is hard than I expected because of unfamiliar words :(
Could you tell me whether my answer is right or not.
Question :
If company A has designed a ...
0
votes
0
answers
26
views
How does x86 ALU instructions access memory for fetching operands? [duplicate]
Recently I am learning assembly but having hard time understanding it.
There was question whether x86 ALU instructions directly access memory for fetching operands,
but I have no idea if it is ...
0
votes
0
answers
19
views
shared memory memcpy performance issue
I'm doing some performance tunning on a shared memory based message queue. I found a strange phenomenon that I can't explain: I ran the same code for 3 epochs, the avg running time is getting better ...
1
vote
0
answers
21
views
How do I assign an address to a label? WinMIPS64
Everything runs well until I reach lw r9, 0(r7) because I dont have the address of the labels. How do I make it so I can store the address of the labels and jump to the label?
Im supposed to make it ...
0
votes
1
answer
70
views
Adding a new instruction to QEMU
I'm a little confused going about adding a new instruction to QEMU and want to confirm if my understanding is right. After going through the source code, I think adding an instruction to QEMU involves ...
0
votes
1
answer
37
views
Does sequential consistency implies cache coherence?
The definition of cache coherence says that:
A read must return the most recent write.
Every write must eventually be accessible via a read.
Writes to a given location are seen in the same order by ...
2
votes
1
answer
51
views
8086 lock pin and ASM LOCK prefix how it works
I am a programmer and learning assembly language in order to intuitively understand how my code run on the CPU.
While I was studying the ASM keyword LOCK, google told me CPU will take exclusive ...
1
vote
0
answers
32
views
Why the stack pointer is special in the register file?
I have a question about the register file.
As I know, the stack pointer is one of the special registers in the register file. Why it is determined specifically?
I mean compiler can define any register ...